langchain-ai/deepagents · error · ValueError
Goal amendment requests require criteria and feedback.
Error message
Goal amendment requests require criteria and feedback.
What it means
Amending an existing goal requires both replacement `criteria` and the `feedback` explaining why, and both must be non-blank strings. When `kind` is `"amend"` and either field is missing or blank, `_goal_criteria_request` raises this `ValueError`.
Source
Thrown at libs/code/deepagents_code/goal_rubric.py:1246
# Values are validated for non-blankness but stored verbatim (not stripped):
# this feature deliberately preserves the user's exact goal/criteria wording,
# and the prompt builders wrap each value in explicit XML boundaries.
optional: dict[str, str] = {}
for key in ("criteria", "feedback", "previous_criteria"):
item = value.get(key)
if item is None:
continue
if not isinstance(item, str):
msg = f"Goal criteria request field {key} must be text."
raise TypeError(msg)
optional[key] = item
if kind == "amend":
criteria = optional.get("criteria", "")
feedback = optional.get("feedback", "")
if not criteria.strip() or not feedback.strip():
msg = "Goal amendment requests require criteria and feedback."
raise ValueError(msg)
return GoalAmendRequest(
request_id=request_id,
objective=objective,
kind="amend",
criteria=criteria,
feedback=feedback,
)
create: GoalCreateRequest = {
"request_id": request_id,
"objective": objective,
"kind": "create",
}
if "feedback" in optional:
create["feedback"] = optional["feedback"]
if "previous_criteria" in optional:
create["previous_criteria"] = optional["previous_criteria"]
return createView on GitHub (pinned to a1af029e6e)
Solutions
- Include both non-blank `criteria` and `feedback` strings in every amend request.
- If there is no amendment, send `kind: "create"` instead of an amend with empty fields.
- Validate the two fields in the caller before dispatching the request.
Example fix
// before
request = {"request_id": rid, "kind": "amend", "objective": obj, "criteria": new_criteria}
// after
request = {"request_id": rid, "kind": "amend", "objective": obj, "criteria": new_criteria, "feedback": "Rubric missing performance bounds"} Defensive patterns
Strategy: validation
Validate before calling
if value.get("kind") == "amend":
criteria = value.get("criteria", "")
feedback = value.get("feedback", "")
if not criteria.strip() or not feedback.strip():
raise ValueError("amend requests need non-blank criteria and feedback") Type guard
def is_complete_amend_request(value: dict) -> bool:
if value.get("kind") != "amend":
return True
return all(
isinstance(value.get(k), str) and value.get(k, "").strip()
for k in ("criteria", "feedback")
) Try / catch
try:
run_middleware(state)
except ValueError as e:
if "require criteria and feedback" in str(e):
collect_missing_amend_fields_from_user() Prevention
- Make both fields required inputs in any amend UI/command flow.
- Use separate builder functions for create vs amend so amend-specific fields can't be dropped.
- Add a unit test asserting amend requests without criteria/feedback are rejected at your boundary.
When it happens
Trigger: Building an amend-kind goal-criteria request with `criteria` and/or `feedback` omitted, empty, or whitespace-only; supplying only one of the two.
Common situations: A caller reusing a create-request builder (which needs no feedback) for amend flows; UI flows that collect feedback but forget to forward it; blank user input passed through unvalidated.
Understand the failure class
Background: "Missing required field" and "field is required" errors: why libraries reject payloads that omit mandatory fields — this error's family across 20 libraries.
Related errors
- Goal criteria request requires a request_id.
- Goal criteria request requires an objective.
- Could not parse embedded resource block. Block expected eith
- question text must not be blank
- choice has a blank 'value': {choice!r}
AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29).
Data as JSON: /api/errors/653c1b195465661c.
Report an issue: GitHub.