Hmbown/CodeWhale · error
needs_input should be projected
Error message
needs_input should be projected
What it means
Panic from `.expect("needs_input should be projected")`: the projection built for the parent has `needs_input: None`. The projection must translate the interrupted checkpoint into a NeedsInput question telling the parent to 'Re-dispatch this worker'; without it the parent cannot wake the worker.
Solutions
- Ensure projection synthesizes needs_input whenever checkpoint.continuable and needs_continuation are true
- Check the api_timeout reason is handled in the question template selection
- Verify the question text still includes "Re-dispatch this worker"
- Log the projection fields on failure to see which precondition was false
Example fix
// before
.expect("needs_input should be projected")
// after
.unwrap_or_else(|| panic!("projection missing needs_input; continuation={} ckpt={}",
projection.needs_continuation, projection.checkpoint.is_some())) Defensive patterns
Strategy: type-guard
Type guard
fn has_redispatch_question(p: &Projection) -> bool {
p.needs_input.as_ref().map_or(false, |n| n.question.contains("Re-dispatch this worker"))
} Try / catch
let needs = projection.needs_input.as_ref()
.unwrap_or_else(|| panic!("no needs_input projected for continuable checkpoint")); Prevention
- Drive needs_input synthesis from checkpoint presence, not from specific reasons
- Keep wake/re-dispatch wording in a shared constant used by both code and tests
- Cover api_timeout checkpoints in projection unit tests
When it happens
Trigger: Building the projection from an Interrupted result with an api_timeout checkpoint when the needs_input synthesis step is skipped, the checkpoint reason isn't recognized, or projection.needs_continuation is false so no question is generated.
Common situations: Projection code only maps user-checkpoints to needs_input and misses api_timeout; question template changed so the contains("Re-dispatch this worker") assert also fails; checkpoint omitted from projection input.
Related errors
- Agent continuation target is no longer retained
- Agent continuation target is outside the active session
- Agent not found
- Agent session not found
- Agent session name ' ' is ambiguous; use an agent_id
AI-assisted analysis of Hmbown/CodeWhale@433685b202 (2026-09-15).
Data as JSON: /api/errors/d54c3bf9a0a7311d.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/tools/subagent/tests.rs:9062
);
assert!(interrupted.needs_input.is_some());
let ctx = runtime.context.clone();
let worker_record = {
let manager = manager.read().await;
manager.get_worker_record(&agent_id)
};
let projection =
subagent_session_projection(interrupted.clone(), false, &ctx, worker_record).await;
assert_eq!(projection.status, "waiting_for_user");
assert!(projection.continuable);
assert!(projection.needs_continuation);
assert!(projection.checkpoint.is_some());
assert!(
projection
.needs_input
.as_ref()
.expect("needs_input should be projected")
.question
.contains("Re-dispatch this worker"),
"projection should tell the parent how to wake/re-dispatch: {:?}",
projection.needs_input
);
assert_eq!(
projection
.worker_record
.as_ref()
.expect("worker record")
.status,
AgentWorkerStatus::WaitingForUser
);
assert_eq!(
projection
.worker_record
.as_ref()
.expect("worker record")View on GitHub (pinned to 433685b202)