Skip to content

[ENHANCEMENT] robotcode CLI: .set cannot create a variable; clarify the help text or allow it #670

Closed

Description

@manykarim

Is your enhancement request related to a problem? Please describe.
.help set says: "Set a scalar variable in the selected frame … The assignment lands in the selected frame's local scope." That reads like a normal assignment. For a variable that does not exist yet, .set fails with Variable '${x}' not found., which looks like a lookup bug rather than a rule.

# t.robot: a test that assigns ${value} on line 3, then fails on line 4
printf '.set ${fresh} hello\n.set ${value} 7\n.c\n' \
  | robotcode robot-debug --plain --no-history --break t.robot:4 t.robot
(rdb) ! Variable '${fresh}' not found.
(rdb) ${value} = '7'

Describe the solution you'd like
Either:

  • allow .set to create a new local scalar, or
  • keep the rule but say so in .help set and in the error: .set only changes existing variables; use ${x}= Set Variable … to create one.

Describe alternatives you've considered
The workaround ${fresh}= Set Variable hello at the prompt works fine. This is about discoverability.

Additional context
The behaviour is intentional in the controller (set_variable L321-L335, "Raises NameError if the variable is unknown"), but the user-facing help (L1637-L1645) does not mention it.

Environment

  • Scope: robotcode CLI only (no VS Code / IntelliJ involved)
  • RobotCode version: 2.7.0 (PyPI robotcode[all]); also reproduced on main @ 20c1767
  • OS: Linux (Ubuntu, kernel 6.8, x86_64)
  • Python version: 3.13.11
  • Robot Framework version: 7.5

AI / tooling disclosure
This report was prepared with assistance from Claude Code (Anthropic) during a series of hands-on robotcode CLI experiments. I reviewed the text, re-ran the steps above locally on both v2.7.0 and main @ 20c1767, and confirm the behaviour described.

Activity

  1. d-biehl commented on Oct 9, 2026

    @d-biehl
    Member

    Thanks for the report. .set stays as it is: like the Variables view of the VS Code debugger, it only changes variables that already exist, and the error message is unchanged.

    .help set and the command-line debugging guide now say that, and show how to create a variable at the prompt instead (${x}= Set Variable …). The help also no longer suggests ${{ … }} for Python values, because .set always stores the value as a string; for other types, assign at the prompt, e.g. ${items}= Evaluate [1, 2]. The robotcode agent skill got the same correction.

    While looking into this, we found that setting variables in either debugger doesn't work the way the Variables view suggests, both for scopes and for value types. That's collected in #671.

  2. added a commit that references this issue on Oct 9, 2026
    88d43e2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions