Skip to content

Troubleshooting robot.toml

When a setting does not do what you expect, the commands in Checking what a run gets show where the configuration comes from and what a run gets. The sections below say which of them to use for which problem. The editors show the errors of the configuration as error messages when RobotCode's language server starts.

Robot Framework's own robot command does not read robot.toml. Run the tests with robotcode run.

Go through the steps in which RobotCode combines the settings:

  1. The right project? robotcode config root shows which folder RobotCode takes as the project root. Started in a folder without a configuration further up, it may stop at the .git folder of the repository; see The project root.
  2. The right file? robotcode config files lists the files RobotCode reads. A robot.toml in a subfolder of the project root is not read.
  3. The right profile? robotcode profiles list shows which profiles are selected. Without -p, only the default profiles apply. A profile with an enabled condition may be disabled on your machine: robotcode -v -p <name> profiles show says whether RobotCode uses it or skips it.
  4. Replaced later? robotcode -v profiles show and robotcode config show -s show whether a later file or profile replaces the setting, for example a .robot.toml or a profile with a higher precedence.
  5. Replaced on the command line? An option on the command line with a single value, such as -d, replaces the one of the configuration.

A setting without extend- replaces the value before it:

  • [variables] in a profile or in .robot.toml leaves only its own variables. Use [extend-variables] to change single variables and keep the others.
  • [profiles.<name>] in .robot.toml replaces all profiles of robot.toml. Use [extend-profiles.<name>].
  • python-path or output-dir in robot.toml replace the defaults of the user configuration, ./lib and ./resources or results.

See Replacing and extending.

  • Hidden: a profile with hidden = true, or with a name that starts with _, is left out of robotcode profiles list and of the profile lists of the editors. robotcode profiles list -h shows it, and -p selects it by name.
  • Replaced: [profiles.<name>] in a later file replaces the profiles of the earlier files, see above.

No profile has the name, or matches the pattern, that -p, ROBOTCODE_PROFILES, the editor's selection, default-profiles or inherits names. The message names it; check its spelling against the profiles that robotcode profiles list -h lists.

For a name of -p, ROBOTCODE_PROFILES, the editor's selection or inherits, the command stops before it runs anything, robotcode run with exit code 252, while robotcode profiles list still lists the profiles. A name of default-profiles is only reported, and the command runs without it: the default-profiles of your user configuration can name a profile of that file, which the [profiles] of a project replace.

The language server starts anyway and shows the message for ROBOTCODE_PROFILES, default-profiles and inherits in the editor. A name of the editor's selection is reported by the editor itself, with Remove from Selection and Select Configuration Profiles; see VS Code and PyCharm.

A profile inherits itself, directly or through other profiles, for example a with inherits = ["b"] and b with inherits = ["a"]. The message shows the way, a -> b -> a. The command stops before it runs anything, robotcode run with exit code 252; the language server starts without the profiles and shows the message. A pattern in inherits never matches the profile that has it, so ci-linux with inherits = ["ci-*"] inherits the other ci- profiles.

"Value '3' must be of type str | StringExpression but is int"

Section titled “"Value '3' must be of type str | StringExpression but is int"”

The values of variables, metadata and environment variables are text. Put numbers in quotes: RETRIES = "3". The message names the file and the setting, such as variables.RETRIES.

Relative paths in the configuration count from the project root, not from the folder in which you start the command, and not from the folder of the file that sets them; see The project root. robotcode config root shows the root.

The editors restart RobotCode's language server when robot.toml, .robot.toml or pyproject.toml change. In VS Code, each workspace folder has its own configuration: check that the file is in the folder of the files you work on. See also Troubleshooting in VS Code and Troubleshooting in PyCharm.

Released under the Apache-2.0. Copyright © 2022-present Daniel Biehl