Skip to content

Instantly share code, notes, and snippets.

@TurtleShip
Last active August 1, 2025 23:00
Show Gist options
  • Save TurtleShip/6be1711d55b47b1fb505f38faf1c9489 to your computer and use it in GitHub Desktop.
Save TurtleShip/6be1711d55b47b1fb505f38faf1c9489 to your computer and use it in GitHub Desktop.
Semantic errors

Semantic Errors

Definition: "I can parse what you wrote, but it doesn't make sense" - violations of meaning or contracts within a correctly structured format. The parser successfully extracts function calls, but they violate tool contracts or constraints.

Characteristics:

  • Structure (syntax) is valid but violates the tool's interface specification
  • Parser can extract the function call
  • Validation against tool definition fails
  • There exists a potential tool definition that would make this call valid but it is not the one that is in the system prompt

ToolNotFound

Tool resolution failed - the specified tool name doesn't exist or isn't accessible.

UnknownTool

Tool name not recognized in the system.

Example:

<function_calls>
<invoke name="get_weather_info">  <!-- Function doesn't exist -->
<parameter name="location">["San Francisco", "CA"]</parameter>
</invoke>
</function_calls>

Current implementation mapping: BadArgumentOrName + "Unrecognized tool name" → Penalty: FCUReactorInvalidToolName

InaccessibleTool

Tool exists but not accessible in current context.

What it is: Occurs when the model tries to call a tool that exists in the system but is marked as is_externally_callable=False. These tools are hidden from the system prompt and are typically internal "meta tools" meant to be called only by other tools, not directly by the model.

Why it's penalized: The model is calling a tool it was never told about (filtered out of system prompt), indicating it's either hallucinating tool names or trying to guess hidden functionality.

Current implementation mapping: BadArgumentOrName + "not externally callable" → Penalty: FCUReactorInvalidToolName

MissingRequiredParameter

A parameter marked as required in the tool definition is not provided.

Examples (assuming 'location' is required for get_current_weather, 'to' is required for send_email):

<!-- Missing 'to' parameter for send_email -->
<function_calls>
<invoke name="send_email">
<parameter name="subject">Weather Alert</parameter>
<parameter name="body">It might rain!</parameter>
<!-- Missing required "to" parameter -->
</invoke>
</function_calls>

Current implementation mapping: BadArgumentOrName + "Missing required parameter {param.name}" → Penalty: FCUReactorInvalidToolName

UnknownParameter

Parameter name provided doesn't exist in the tool definition.

Examples:

<!-- Wrong parameter name: 'place' instead of 'location' -->
<function_calls>
<invoke name="get_current_weather">
<parameter name="place">["San Francisco", "CA"]</parameter>
<parameter name="units">fahrenheit</parameter>
</invoke>
</function_calls>

Current implementation mapping: BadArgumentOrName + "Unknown parameter {param_name}" → Penalty: FCUReactorInvalidToolName

InvalidParameterValue

Parameter value fails validation against the tool's schema.

WrongType

Value is of wrong JSON type (e.g., string instead of number).

Example (assuming 'location' must be an array):

<function_calls>
<invoke name="get_current_weather">
<parameter name="location">San Francisco</parameter>  <!-- Should be array -->
</invoke>
</function_calls>

Current implementation mapping: BadArgumentOrName + "does not match type={param.schema_str}" → Penalty: FCUReactorInvalidToolName

InvalidStructure

Wrong object shape - missing required properties or extra properties not allowed.

Current implementation mapping: BadArgumentOrName + "does not match type={param.schema_str}" → Penalty: FCUReactorInvalidToolName

ConstraintViolation

Right type/structure but value violates constraints. This is a conceptual grouping that encompasses:

  • OutOfRange: Number outside allowed range (min/max)
  • InvalidLength: String or array length violation (minLength/maxLength)
  • PatternMismatch: String doesn't match required regex pattern
  • InvalidOption: Value not in allowed enumeration

Example (assuming 'units' must be 'celsius' or 'fahrenheit'):

<function_calls>
<invoke name="get_current_weather">
<parameter name="location">["San Francisco", "CA"]</parameter>
<parameter name="units">kelvin</parameter>  <!-- Not in enum [celsius, fahrenheit] -->
</invoke>
</function_calls>

Current implementation mapping: BadArgumentOrName + "does not match type={param.schema_str}" → Penalty: FCUReactorInvalidToolName

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment