{"record":{"id":"a144438585338127","repo":"CherryHQ/cherry-studio","slug":"claude-p-exited-result-returncode-nstderr-res","errorCode":null,"errorMessage":"claude -p exited {result.returncode}\\nstderr: {result.stderr}","messagePattern":"claude -p exited (.+?)\\\\nstderr: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"resources/skills/skill-creator/scripts/improve_description.py","lineNumber":45,"sourceCode":"    if model:\n        cmd.extend([\"--model\", model])\n\n    # Remove CLAUDECODE env var to allow nesting claude -p inside a\n    # Claude Code session. The guard is for interactive terminal conflicts;\n    # programmatic subprocess usage is safe. Same pattern as run_eval.py.\n    env = {k: v for k, v in os.environ.items() if k != \"CLAUDECODE\"}\n\n    result = subprocess.run(\n        cmd,\n        shell=False,\n        input=prompt,\n        capture_output=True,\n        text=True,\n        env=env,\n        timeout=timeout,\n    )\n    if result.returncode != 0:\n        raise RuntimeError(\n            f\"claude -p exited {result.returncode}\\nstderr: {result.stderr}\"\n        )\n    return result.stdout\n\n\ndef improve_description(\n    skill_name: str,\n    skill_content: str,\n    current_description: str,\n    eval_results: dict,\n    history: list[dict],\n    model: str,\n    test_results: dict | None = None,\n    log_dir: Path | None = None,\n    iteration: int | None = None,\n) -> str:\n    \"\"\"Call Claude to improve the description based on eval results.\"\"\"\n    failed_triggers = [","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/CherryHQ/cherry-studio/blob/726446b54cd69ffe51a276638672f6d95ca0768c/resources/skills/skill-creator/scripts/improve_description.py#L27-L63","documentation":"Error \"claude -p exited {result.returncode}\\nstderr: {result.stderr}\" thrown in CherryHQ/cherry-studio.","triggerScenarios":"The skill-creator improve_description script shells out to `claude -p` and the CLI exits with a non-zero return code.","commonSituations":"Occurs when the Claude CLI is missing, unauthenticated, rate-limited, or the prompt run otherwise fails. The RuntimeError includes the exit code and captured stderr; the description improvement run aborts.","solutions":["Read the stderr included in the message to see why the claude CLI failed.","Verify the claude CLI is installed, on PATH, and authenticated before running improve_description.py.","Retry after fixing the reported CLI error (auth, model access, or rate limit)."],"exampleFix":"Authenticate the CLI (claude login) and confirm `claude -p \"hello\"` succeeds, then rerun the script.","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"726446b54cd69ffe51a276638672f6d95ca0768c","analyzedAt":"2026-08-12T17:30:37.448Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}