Error Explainer

Explain an error message or stack trace in plain English: the likely cause and fixes with code.

Pay by wallet (x402) AI-generated error-explain

Example

Example answer
{
  "fixes": [
    {
      "description": "Declare and initialize the variable before use",
      "code_example": "test_value = 'some_value'\nprint(test_value)"
    },
    {
      "description": "Check variable name spelling and scope",
      "code_example": "# Ensure the variable is defined in the correct scope\nclass MyClass:\n    def __init__(self):\n        self.test_value = 'initialized_value'"
    },
    {
      "description": "Import the variable if it's from another module",
      "code_example": "from module_name import test_value"
    }
  ],
  "error_type": "Undefined Variable / Missing Value Error",
  "prevention": "Always declare variables before use, use consistent naming conventions, enable linting tools to catch undefined variables, and use type hints to clarify expected values.",
  "root_cause": "The variable 'test_value' was referenced without being declared, initialized, or imported first. This is commonly caused by typos in variable names, missing variable declarations, or attempting to access a variable outside its scope.",
  "search_terms": [
    "undefined variable error",
    "NameError Python",
    "variable not defined",
    "scope error"
  ],
  "related_errors": [
    "NameError: name is not defined",
    "AttributeError: object has no attribute",
    "UnboundLocalError: local variable referenced before assignment",
    "ReferenceError (JavaScript equivalent)"
  ],
  "plain_explanation": "The system encountered a reference to 'test_value' that was not defined, initialized, or assigned before being used. This indicates the variable doesn't exist in the current scope or context."
}

Inputs

FieldTypeRequiredWhat it is
errorstringYes—
contextstringNo—
languagestringNo—

Output fields

How reliably each field appears in a successful answer.

FieldTypeAppears
fixesarrayAlways (present in every successful answer)
error_typestringAlways (present in every successful answer)
root_causestringAlways (present in every successful answer)
plain_explanationstringAlways (present in every successful answer)

How to call it

The same tool through each route. MCP clients reach it through Strale’s server at https://api.strale.io/mcp; the call below is what the agent sends.

# Needs an API key. max_price_cents caps what this call may cost.
curl -X POST https://api.strale.io/v1/do \
  -H "Authorization: Bearer $STRALE_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "capability_slug": "error-explain",
    "inputs": {
      "error": "test_value",
      "context": "This is a test input for automated capability testing.",
      "language": "en"
    },
    "max_price_cents": 5
  }'

Limitations

  • Suggested causes may not match your environment

    AI explanation of error messages — root cause suggestions are based on common patterns and may not match your specific environment

    What to do instead: Use the suggested causes as debugging hypotheses and verify against your application's logs and configuration