langchain-ai/deepagents · error · ValueError
Rubric file {path!r} is empty.
Error message
Rubric file {path!r} is empty. What it means
`_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.
Source
Thrown at libs/code/deepagents_code/main.py:1536
# An `@`-prefixed value is always read as a file path. The path may be
# absolute, relative to the `dcode` process working directory, or `~`-based.
# There is no way to pass a literal rubric that begins with `@` (put such
# text in a file).
if rubric.startswith("@"):
path = rubric[1:]
try:
text = Path(path).expanduser().read_text(encoding="utf-8")
except (OSError, UnicodeError) as exc:
# `UnicodeError` (e.g. `UnicodeDecodeError`) subclasses `ValueError`,
# not `OSError`. Catch it here so a binary/non-UTF-8 file yields the
# framed "Could not read rubric file" message instead of a raw codec
# error.
msg = f"Could not read rubric file {path!r}: {exc}."
raise ValueError(msg) from exc
if not text.strip():
msg = f"Rubric file {path!r} is empty."
raise ValueError(msg)
resolved = text.strip()
validate_rubric(resolved)
return resolved
if not rubric.strip():
msg = "--rubric must not be empty."
raise ValueError(msg)
resolved = rubric.strip()
validate_rubric(resolved)
return resolved
# The standalone `validate_rubric` above is sufficient here, unlike `/rubric next`,
# which additionally runs the combined notice check via `_next_rubric_size_error`.
# That check exists because an in-session one-shot rubric is embedded in the notice
# beside an actionable goal's objective and status note, and the pair can exceed
# `GOAL_NOTICE_TEXT_CHAR_LIMIT` even when each fits alone. `--rubric` cannot reach
# that state: it requires `-n`, and `run_non_interactive` takes no resume orView on GitHub (pinned to a1af029e6e)
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
Example fix
// before $ touch rubric.txt && dcode --rubric-file rubric.txt // after $ printf "Check that tests pass and no regressions were introduced\n" > rubric.txt $ dcode --rubric-file rubric.txt
Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
text = Path("rubric.txt").read_text(encoding="utf-8")
if not text.strip():
raise SystemExit("rubric.txt is empty; write rubric content first") Try / catch
try:
rubric = _resolve_rubric_text(args)
except ValueError as exc:
raise SystemExit(f"bad rubric input: {exc}") Prevention
- 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
When it happens
Trigger: `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).
Common situations: 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.
Related errors
- --rubric must not be empty.
- Cannot combine 'all' with other commands in --shell-allow-li
- cli_max_retries must be >= 0, got {self.cli_max_retries}
- Error: Invalid skill name: {error_msg}
- Error: {path_error}
AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29).
Data as JSON: /api/errors/76387cb1d358e24c.
Report an issue: GitHub.