{"record":{"id":"6a9bd2e09942ab7e","repo":"langchain-ai/deepagents","slug":"rubric-must-not-be-empty","errorCode":null,"errorMessage":"--rubric must not be empty.","messagePattern":"--rubric must not be empty\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/main.py","lineNumber":1543,"sourceCode":"        try:\n            text = Path(path).expanduser().read_text(encoding=\"utf-8\")\n        except (OSError, UnicodeError) as exc:\n            # `UnicodeError` (e.g. `UnicodeDecodeError`) subclasses `ValueError`,\n            # not `OSError`. Catch it here so a binary/non-UTF-8 file yields the\n            # framed \"Could not read rubric file\" message instead of a raw codec\n            # error.\n            msg = f\"Could not read rubric file {path!r}: {exc}.\"\n            raise ValueError(msg) from exc\n        if not text.strip():\n            msg = f\"Rubric file {path!r} is empty.\"\n            raise ValueError(msg)\n        resolved = text.strip()\n        validate_rubric(resolved)\n        return resolved\n\n    if not rubric.strip():\n        msg = \"--rubric must not be empty.\"\n        raise ValueError(msg)\n    resolved = rubric.strip()\n    validate_rubric(resolved)\n    return resolved\n\n\n# The standalone `validate_rubric` above is sufficient here, unlike `/rubric next`,\n# which additionally runs the combined notice check via `_next_rubric_size_error`.\n# That check exists because an in-session one-shot rubric is embedded in the notice\n# beside an actionable goal's objective and status note, and the pair can exceed\n# `GOAL_NOTICE_TEXT_CHAR_LIMIT` even when each fits alone. `--rubric` cannot reach\n# that state: it requires `-n`, and `run_non_interactive` takes no resume or\n# thread-id argument, so it always starts a fresh thread with no checkpointed goal.\n# `--goal` is rejected alongside `--rubric` and is interactive-only, so no goal\n# objective can be set on this path either. Add the combined check here if the\n# non-interactive path ever gains thread resumption.\n\n\ndef _warn_if_interpreter_tools_without_interpreter(","sourceCodeStart":1525,"sourceCodeEnd":1561,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/main.py#L1525-L1561","documentation":"`_resolve_rubric_text` raises `ValueError` when the inline `--rubric` string is empty or whitespace-only. Like the file variant, an empty inline rubric is rejected because it would make the run effectively rubric-less.","triggerScenarios":"`cli_main --rubric \"\"` or `--rubric \"   \"` — typically from a shell variable that failed to expand (`--rubric \"$RUBRIC\"` with unset `RUBRIC`) or a script that builds the flag conditionally and drops the content.","commonSituations":"Unset/empty environment variable interpolated into the flag; CI pipeline where the rubric artifact step was skipped; copy-paste losing the quoted text.","solutions":["Set the rubric text explicitly: `dcode --rubric \"<your rubric>\"`","Guard shell usage: `[ -n \"$RUBRIC\" ] || { echo 'RUBRIC is empty'; exit 1; }` before invoking","Use `--rubric-file` pointing to a non-empty file instead of inline text"],"exampleFix":"// before\ndcode --rubric \"$RUBRIC\"   # RUBRIC unset -> empty string\n// after\n[ -n \"$RUBRIC\" ] || { echo \"RUBRIC is empty\" >&2; exit 1; }\ndcode --rubric \"$RUBRIC\"","handlingStrategy":"validation","validationCode":"import os\n\nrubric = os.environ.get(\"RUBRIC\", \"\")\nif not rubric.strip():\n    raise SystemExit(\"RUBRIC is empty; refusing to launch\")","typeGuard":null,"tryCatchPattern":"try:\n    rubric = _resolve_rubric_text(args)\nexcept ValueError as exc:\n    raise SystemExit(f\"bad rubric input: {exc}\")","preventionTips":["Use `${RUBRIC:?}` in shell scripts to fail fast on unset variables","Quote inline rubric text carefully to avoid losing it in shell parsing","Prefer --rubric-file over inline strings for long or scripted rubrics"],"tags":["validation","cli","rubric"],"backgroundTag":"empty-input-file","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}