dagger/dagger · error
failed to serialize service ID: %w
Error message
failed to serialize service ID: %w
What it means
prepTerminal wraps any error from dump.DumpID when serializing the derived service (recipe) ID for terminal output. DumpID encodes the dagql ID object into the output stream; a failure here means the ID could not be marshaled/encoded even though it was successfully derived. It is a low-level serialization failure, not a terminal-selection problem.
Source
Thrown at core/terminal.go:446
return nil, nil, fmt.Errorf("failed to get dagql server: %w", err)
}
res, err := dag.LoadType(ctx, svcID)
if err != nil {
return nil, nil, fmt.Errorf("failed to load service from handle ID: %w", err)
}
recipeIDable, ok := res.(interface {
RecipeID(context.Context) (*call.ID, error)
})
if !ok {
return nil, nil, fmt.Errorf("loaded service %T does not expose a recipe ID", res)
}
dumpID, err = recipeIDable.RecipeID(ctx)
if err != nil {
return nil, nil, fmt.Errorf("failed to derive service recipe ID: %w", err)
}
}
if err := dump.DumpID(output, dumpID); err != nil {
return nil, nil, fmt.Errorf("failed to serialize service ID: %w", err)
}
fmt.Fprint(term.Stderr, dump.Newline)
if execErr != nil {
fmt.Fprintf(term.Stderr,
output.String("! %s").Foreground(termenv.ANSIYellow).String(), execErr.Error())
fmt.Fprint(term.Stderr, dump.Newline)
}
return term, output, nil
}
// prepTerminalEnv creates a custom shell prompt `dagger:<cwd>$`
func prepTerminalEnv(output *termenv.Output, env []string) []string {
env = append(env, fmt.Sprintf("PS1=%s %s $ ",
output.String("dagger").Foreground(termenv.ANSIYellow).String(),
output.String(`$(pwd | sed "s|^$HOME|~|")`).Faint().String(),
))
return envView on GitHub (pinned to 82ba2681db)
Solutions
- Retry the command; transient serialization failures in the live session usually do not recur.
- Check the wrapped cause (%w) to identify the underlying encoding error.
- Update the dagger CLI/engine to matching versions; mixed versions can break ID encoding.
- File an issue with the wrapped error if reproducible.
Example fix
null
Defensive patterns
Strategy: try-catch
Try / catch
id, err := recipeIDable.RecipeID(ctx)
if err != nil {
return fmt.Errorf("terminal: derive recipe ID: %w", err)
}
if err := dump.DumpID(output, id); err != nil {
return fmt.Errorf("terminal: serialize ID: %w", err)
} Prevention
- Keep CLI and engine versions in sync
- Retry transient serialization failures
- Include the wrapped cause in bug reports
When it happens
Trigger: Calling `dagger terminal` (or the internal `terminal` function) on a service/container target when the derived RecipeID's dagql object cannot be encoded by DumpID — e.g. corrupted or unsupported ID object state in the current query session.
Common situations: Internal engine/query state inconsistencies after upgrading a session, or a bug in ID encoding for a newly added object type; rarely hit by end users directly.
Related errors
- before ID: %w
- after ID: %w
- message %d: %w
- module object SDK input call frame: %w
- encode persisted module object field %q: %w
AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05).
Data as JSON: /api/errors/1e4948364d3ea4a8.
Report an issue: GitHub.