{"record":{"id":"86ea84952798251c","repo":"can1357/oh-my-pi","slug":"message-86ea84","errorCode":null,"errorMessage":"message","messagePattern":"message","errorType":"exception","errorClass":"RpcCommandError","httpStatus":null,"severity":"error","filePath":"python/robomp/src/host_tools.py","lineNumber":218,"sourceCode":"    label_cleared = _remove_needs_info_label(bindings)\n    bindings.db.set_issue_state(bindings.issue_key, state)\n    return label_cleared\n\n\ndef _audit(\n    bindings: ToolBindings, name: str, args: Mapping[str, Any], result: Any | None = None, error: str | None = None\n) -> None:\n    bindings.db.log_tool_call(\n        issue_key=bindings.issue_key,\n        tool=name,\n        args=args,\n        result=result if isinstance(result, Mapping) else ({\"value\": result} if result is not None else None),\n        error=error,\n    )\n\n\ndef _raise_command(message: str) -> NoReturn:\n    raise RpcCommandError(message, error={\"message\": message})\n\n\ndef _require_issue(bindings: ToolBindings) -> IssueInfo:\n    if bindings.issue is None:\n        _raise_command(\"this tool requires issue context\")\n    return bindings.issue\n\n\ndef _require_release(bindings: ToolBindings) -> ReleaseToolContext:\n    if bindings.release is None:\n        _raise_command(\"this tool requires release context\")\n    return bindings.release\n\n\ndef _git_identity_env(author_name: str, author_email: str) -> dict[str, str]:\n    \"\"\"Environment forcing agent git commits to use the configured bot identity.\"\"\"\n    return {\n        \"GIT_AUTHOR_NAME\": author_name,","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/python/robomp/src/host_tools.py#L200-L236","documentation":"RpcCommandError raised by _raise_command, the shared helper host tools use to fail a tool invocation with a structured error payload. The exact message varies per call site (e.g. \"this tool requires issue context\") — it signals a precondition of the tool binding was not met.","triggerScenarios":"Calling a tool (execute, issue/release helpers, pre-publish bun fix/check/test) when the required binding context is absent — e.g. _require_issue fires when bindings.issue is None; bun pre-publish checks fail when the bun command fails.","commonSituations":"Invoking an issue-scoped tool outside an issue context (dashboard/manual call with no session issue), running release publish with failing bun lint/test/typecheck.","solutions":["Provide the required context (attach issue/release bindings) before invoking the tool","Read the error `message` in the error payload — it names the missing precondition or underlying command failure","If from bun pre-publish checks, fix the lint/typecheck/test failures reported underneath"],"exampleFix":"// before: calling issue tool with no context\nawait tools.execute(\"issue_comment\", {...})  # bindings.issue is None\n// after: ensure issue context, or handle\nif bindings.issue is None:\n    raise Skip(\"issue tool requires issue context\")\nresult = await tools.execute(\"issue_comment\", {...})","handlingStrategy":"type-guard","validationCode":"if bindings.issue is None:\n    raise Skip(\"issue context required\")\nissue = bindings.issue","typeGuard":"def has_issue_context(b: ToolBindings) -> bool:\n    return b.issue is not None","tryCatchPattern":"try:\n    result = await tool.execute(args)\nexcept RpcCommandError as e:\n    log.warning(\"tool precondition failed: %s\", e.message)\n    return fallback_result","preventionTips":["Check binding presence (issue/release) before invoking scoped tools","Wire pre-publish bun checks locally (bun lint/typecheck/test) before calling release tools","Surface the structured error.message to the operator instead of swallowing it"],"tags":["rpc","tool-invocation","precondition"],"backgroundTag":"missing-tool-context","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}