{"record":{"id":"76387cb1d358e24c","repo":"langchain-ai/deepagents","slug":"rubric-file-path-r-is-empty","errorCode":null,"errorMessage":"Rubric file {path!r} is empty.","messagePattern":"Rubric file (.+?) is empty\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/main.py","lineNumber":1536,"sourceCode":"\n    # An `@`-prefixed value is always read as a file path. The path may be\n    # absolute, relative to the `dcode` process working directory, or `~`-based.\n    # There is no way to pass a literal rubric that begins with `@` (put such\n    # text in a file).\n    if rubric.startswith(\"@\"):\n        path = rubric[1:]\n        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","sourceCodeStart":1518,"sourceCodeEnd":1554,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/main.py#L1518-L1554","documentation":"`_resolve_rubric_text` raises `ValueError` when a rubric file is readable but contains only whitespace. An empty rubric carries no grading signal, so the CLI rejects it early instead of proceeding with an ineffective rubric.","triggerScenarios":"`cli_main --rubric-file <path>` where the file is zero bytes or contains only spaces/newlines (e.g. an editor saved an empty buffer, or a redirect `> rubric.txt` truncated it).","commonSituations":"A failed paste into the rubric file; a script that created the file but failed to write content; `touch rubric.txt` used as a placeholder then forgotten.","solutions":["Open the file and paste/save the actual rubric content","Check for scripts that truncate the file (`> rubric.txt` before writing) and fix the write order","Pass the rubric inline with `--rubric \"...\"` instead if the file content is genuinely unavailable"],"exampleFix":"// before\n$ touch rubric.txt && dcode --rubric-file rubric.txt\n// after\n$ printf \"Check that tests pass and no regressions were introduced\\n\" > rubric.txt\n$ dcode --rubric-file rubric.txt","handlingStrategy":"validation","validationCode":"from pathlib import Path\n\ntext = Path(\"rubric.txt\").read_text(encoding=\"utf-8\")\nif not text.strip():\n    raise SystemExit(\"rubric.txt is empty; write rubric content first\")","typeGuard":null,"tryCatchPattern":"try:\n    rubric = _resolve_rubric_text(args)\nexcept ValueError as exc:\n    raise SystemExit(f\"bad rubric input: {exc}\")","preventionTips":["After writing a rubric file, check it is non-empty (`wc -c rubric.txt`)","Avoid `touch` placeholders; create files with content in one step","In scripts, validate file size before passing --rubric-file"],"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"}