Hmbown/CodeWhale · error
--resume/--session-id needs a session id, but got an empty…
Error message
--resume/--session-id needs a session id, but got an empty value (an unset shell variable?). Use `codewhale --continue` to resume the most recent session.
What it means
The resume path trims the supplied `--resume`/`--session-id` value and bails if it is empty. The guard exists because a shell expanding an unset variable (`codewhale --resume "$SESSION_ID"`) would otherwise quietly start a fresh session, and the loss of intended history is invisible until it is too late. The error suggests `--continue` to resume the most recent session.
Solutions
- Provide the actual session id: `codewhale --resume <real-session-id>`.
- If you just want the latest session, use `codewhale --continue` instead.
- Guard shell scripts: `: "${SESSION_ID:?SESSION_ID is not set}"` before invoking.
- List available sessions (`codewhale sessions` or the session store) to find the correct id.
Example fix
// before codewhale --resume "$SESSION_ID" # unset // error: --resume/--session-id needs a session id, but got an empty value... // after codewhale --resume 3f9c1a2e-... // or: codewhale --continue
Defensive patterns
Strategy: fallback
Validate before calling
# shell guard
if [ -z "${SESSION_ID:-}" ]; then
echo "SESSION_ID empty; falling back to --continue" >&2
exec codewhale --continue
fi
codewhale --resume "$SESSION_ID" Try / catch
match run(args) {
Err(e) if e.to_string().contains("got an empty value") => {
eprintln!("empty session id; use `codewhale --continue` for the latest session");
}
r => r?,
} Prevention
- Guard interpolated ids with ${VAR:?msg} in scripts.
- Use --continue when you do not have a concrete id.
- Capture the session id from the command that created the session, not from memory.
When it happens
Trigger: Passing `--resume ""`, `--session-id " "`, or `--resume "$SESSION_ID"` / `--session-id "$ID"` where the shell variable is unset or empty.
Common situations: CI scripts or shell aliases with unset environment variables, sourcing order mistakes where SESSION_ID is defined in a different shell, or users forgetting to paste the id.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- invalid runtime --set: value must not be empty
- A positive pull request number is required
- API key contains invalid control characters
- API key id must be lowercase hex characters — the part…
- API key input is unexpectedly large
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/fe916ba52e97d523.
Report an issue: GitHub.
Appendix: source
Thrown at crates/cli/src/lib.rs:2339
}
}
fn root_tui_passthrough(cli: &Cli) -> Result<Vec<String>> {
let mut forwarded = Vec::new();
if cli.continue_session {
forwarded.push("--continue".to_string());
}
let resume_session_id = cli
.resume
.as_deref()
.or(cli.session_id.as_deref())
.map(str::trim);
if resume_session_id.is_some_and(str::is_empty) {
// A shell expanding an unset variable -- `codewhale --resume
// "$SESSION_ID"` -- must not quietly become a fresh session. The user
// asked to resume; starting new loses the session they meant, and the
// mistake is invisible until the history is gone.
bail!(
"--resume/--session-id needs a session id, but got an empty value \
(an unset shell variable?). Use `codewhale --continue` to resume \
the most recent session."
);
}
if let Some(session_id) = resume_session_id {
forwarded.push("--resume".to_string());
forwarded.push(session_id.to_string());
}
let prompt =
cli.prompt_flag
.iter()
.chain(cli.prompt.iter())
.fold(String::new(), |mut acc, part| {
if !acc.is_empty() {
acc.push(' ');
}View on GitHub (pinned to 73e0f67d83)