Skip to content

[ENHANCEMENT] analyze code: give failed library imports their own diagnostic code #693

Open

Description

@manykarim

Is your enhancement request related to a problem? Please describe.

robotcode analyze code reports a failed library import with the code DataError, the same code as an argument error. Tools that read the JSON output have to parse the message text to tell "the environment lacks a library" from "the code is wrong", and those two need different reactions: install something, or fix the call.

*** Settings ***
Library    NoSuchLibrary
Library    String

*** Test Cases ***
T
    Convert To Upper Case    a    b    c
$ robotcode --format json analyze code g.robot
DataError | Importing library 'NoSuchLibrary' failed: ModuleNotFoundError: No module named 'NoSuchLibrary'
DataError | Keyword 'String.Convert To Upper Case' expected 1 argument, got 3.

Describe the solution you'd like

A distinct code for import failures, for example ImportFailed (or LibraryImportFailed, ResourceImportFailed, VariablesImportFailed), so tools can filter on the code.

Describe alternatives you've considered

Matching the message prefix Importing library '…' failed. It works today but breaks if the wording changes or is translated.

Additional context

We use analyze code in Claude Code hooks and in CI checks for agent skills (MarketSquare/robotframework-plugins). Both need to tell an environment problem from a code problem.

AI / tooling disclosure

Drafted with Claude Code (Claude Opus 5.5), which also ran the reproduction on 2.8.0 and 2.9.0.dev214. I approved it for filing, and Claude Code filed it at my request.

Environment

  • RobotCode Version: 2.8.0 and 2.9.0.dev214 (CLI only)
  • OS: Linux
  • Python Version: 3.13.11
  • RobotFramework Version: 7.4.2

Activity

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