{"record":{"id":"625a19916fb6f81b","repo":"HKUDS/DeepTutor","slug":"output-strip-or-codebuddy-did-not-return-an-ac","errorCode":null,"errorMessage":"{output.strip() or \"CodeBuddy did not return an account model catalog.\"}","messagePattern":"\\{output\\.strip\\(\\) or \"CodeBuddy did not return an account model catalog\\.\"\\}","errorType":"error_code","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"deeptutor/services/llm/provider_core/codebuddy_provider.py","lineNumber":831,"sourceCode":"\n    env = os.environ.copy()\n    if api_key:\n        env[_CODEBUDDY_API_KEY_ENV] = api_key\n    process = await asyncio.create_subprocess_exec(\n        *command,\n        stdin=asyncio.subprocess.DEVNULL,\n        stdout=asyncio.subprocess.PIPE,\n        stderr=asyncio.subprocess.PIPE,\n        env=env,\n        **process_kwargs,\n    )\n    stdout, stderr = await process.communicate()\n    output = (stdout + b\"\\n\" + stderr).decode(\"utf-8\", errors=\"replace\")\n    marker = \"supported models for your account:\"\n    catalog = output.lower().split(marker, 1)[-1] if marker in output.lower() else \"\"\n    models = re.findall(r\"(?m)^\\s*-\\s+([A-Za-z0-9][A-Za-z0-9._-]*)\\s*$\", catalog)\n    if not models:\n        raise RuntimeError(output.strip() or \"CodeBuddy did not return an account model catalog.\")\n    return list(dict.fromkeys(models))\n\n\n__all__ = [\n    \"CodeBuddyProvider\",\n    \"DEFAULT_CODEBUDDY_MODEL\",\n    \"fetch_codebuddy_models\",\n]\n","sourceCodeStart":813,"sourceCodeEnd":840,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/services/llm/provider_core/codebuddy_provider.py#L813-L840","documentation":"The CLI subprocess ran but its output contained no `- model-name` entries after the 'supported models for your account:' marker, so the regex extracted nothing and the provider raises RuntimeError with the CLI's combined stdout/stderr (or a fallback message). The CLI output usually reveals the real cause: not signed in, auth expired, or an error message.","triggerScenarios":"Running fetch_codebuddy_models() while the CodeBuddy account isn't authenticated (CLI prints a login prompt instead of a catalog); CLI version changed its output format so the marker/regex no longer match; CLI emitted an error to stderr.","commonSituations":"Fresh CLI install without `codebuddy login`; long-running servers whose stored session expired; CLI output-format changes after an update breaking the parser.","solutions":["Run `codebuddy --print . --model ...` manually and read the captured output (it's embedded in the exception message) to see the actual CLI error.","Sign in: run the CodeBuddy login flow, then retry the sync.","If output format changed after a CLI update, pin/upgrade to a CLI version whose catalog format matches the parser."],"exampleFix":"# before\n# not signed in\nawait fetch_codebuddy_models()  # RuntimeError with CLI 'please sign in' output\n\n# after\n# terminal\n$ codebuddy login\nawait fetch_codebuddy_models()","handlingStrategy":"try-catch","validationCode":"import shutil\nif not (shutil.which(\"codebuddy\") or shutil.which(\"cbc\")):\n    raise RuntimeError(\"CodeBuddy CLI is required to sync account models.\")","typeGuard":null,"tryCatchPattern":"try:\n    models = await fetch_codebuddy_models()\nexcept RuntimeError as e:\n    logger.error(\"CLI output: %s\", e)  # message contains the CLI stdout/stderr\n    if \"sign\" in str(e).lower():\n        # re-authenticate and retry once\n        models = await fetch_codebuddy_models()\n    else:\n        raise","preventionTips":["Sign in to the CLI before syncing models.","Log the exception message — it embeds the raw CLI output with the root cause.","Pin the CLI version so catalog output format stays parseable."],"tags":["codebuddy","cli-parsing","auth","model-catalog"],"backgroundTag":"cli-output-parse-failed","analyzedSha":"3e82f130422a813cdd73c10b21a44e9325f5821a","analyzedAt":"2026-08-27T06:57:25.364Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}