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.
The tests run without the configuration
Section titled “The tests run without the configuration”Robot Framework's own robot command does not read robot.toml. Run the tests with robotcode run.
A setting has no effect
Section titled “A setting has no effect”Go through the steps in which RobotCode combines the settings:
- The right project?
robotcode config rootshows which folder RobotCode takes as the project root. Started in a folder without a configuration further up, it may stop at the.gitfolder of the repository; see The project root. - The right file?
robotcode config fileslists the files RobotCode reads. Arobot.tomlin a subfolder of the project root is not read. - The right profile?
robotcode profiles listshows which profiles are selected. Without-p, only the default profiles apply. A profile with anenabledcondition may be disabled on your machine:robotcode -v -p <name> profiles showsays whether RobotCode uses it or skips it. - Replaced later?
robotcode -v profiles showandrobotcode config show -sshow whether a later file or profile replaces the setting, for example a.robot.tomlor a profile with a higherprecedence. - Replaced on the command line? An option on the command line with a single value, such as
-d, replaces the one of the configuration.
Variables or profiles are gone
Section titled “Variables or profiles are gone”A setting without extend- replaces the value before it:
[variables]in a profile or in.robot.tomlleaves only its own variables. Use[extend-variables]to change single variables and keep the others.[profiles.<name>]in.robot.tomlreplaces all profiles ofrobot.toml. Use[extend-profiles.<name>].python-pathoroutput-dirinrobot.tomlreplace the defaults of the user configuration,./liband./resourcesorresults.
A profile is missing from the list
Section titled “A profile is missing from the list”- Hidden: a profile with
hidden = true, or with a name that starts with_, is left out ofrobotcode profiles listand of the profile lists of the editors.robotcode profiles list -hshows it, and-pselects it by name. - Replaced:
[profiles.<name>]in a later file replaces the profiles of the earlier files, see above.
"No profile matches"
Section titled “"No profile matches"”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.
"The profile 'a' inherits itself"
Section titled “"The profile 'a' inherits itself"”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.
A path is not found
Section titled “A path is not found”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 editor does not pick up a change
Section titled “The editor does not pick up a change”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