{"record":{"id":"4952872472037442","repo":"affaan-m/ECC","slug":"claude-p-failed-result-stderr-495287","errorCode":null,"errorMessage":"claude -p failed: {result.stderr}","messagePattern":"claude -p failed: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"skills/skill-comply/scripts/spec_generator.py","lineNumber":51,"sourceCode":"    for attempt in range(max_retries + 1):\n        prompt = base_prompt\n        if attempt > 0 and last_error is not None:\n            prompt += (\n                f\"\\n\\nPREVIOUS ATTEMPT FAILED with YAML parse error:\\n\"\n                f\"{last_error}\\n\\n\"\n                f\"Please fix the YAML. Remember to quote all string values \"\n                f\"that contain colons, e.g.: description: \\\"Use type: description format\\\"\"\n            )\n\n        result = subprocess.run(\n            [\"claude\", \"-p\", prompt, \"--model\", model, \"--output-format\", \"text\"],\n            capture_output=True,\n            text=True,\n            timeout=120,\n        )\n\n        if result.returncode != 0:\n            raise RuntimeError(f\"claude -p failed: {result.stderr}\")\n\n        raw_yaml = extract_yaml(result.stdout)\n\n        tmp_path = None\n        with tempfile.NamedTemporaryFile(\n            mode=\"w\", suffix=\".yaml\", delete=False,\n        ) as f:\n            f.write(raw_yaml)\n            tmp_path = Path(f.name)\n\n        try:\n            return parse_spec(tmp_path)\n        except (yaml.YAMLError, KeyError, TypeError) as e:\n            last_error = e\n            if attempt == max_retries:\n                raise\n        finally:\n            if tmp_path is not None:","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/skills/skill-comply/scripts/spec_generator.py#L33-L69","documentation":"Subprocess guard in generate_spec's retry loop: claude -p exited non-zero while generating the compliance spec YAML. stderr is embedded; the loop distinguishes this hard failure from YAML parse errors, which get a retry with feedback instead.","triggerScenarios":"Thrown at skills/skill-comply/scripts/spec_generator.py:51 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the embedded stderr to find the claude CLI failure cause","Fix auth/model issues and re-run spec generation","If the failure is a YAML parse error rather than rc!=0, the script already retries with corrective feedback — check the last error text"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}