{"record":{"id":"1e4948364d3ea4a8","repo":"dagger/dagger","slug":"failed-to-serialize-service-id-w","errorCode":null,"errorMessage":"failed to serialize service ID: %w","messagePattern":"failed to serialize service ID: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/terminal.go","lineNumber":446,"sourceCode":"\t\t\treturn nil, nil, fmt.Errorf(\"failed to get dagql server: %w\", err)\n\t\t}\n\t\tres, err := dag.LoadType(ctx, svcID)\n\t\tif err != nil {\n\t\t\treturn nil, nil, fmt.Errorf(\"failed to load service from handle ID: %w\", err)\n\t\t}\n\t\trecipeIDable, ok := res.(interface {\n\t\t\tRecipeID(context.Context) (*call.ID, error)\n\t\t})\n\t\tif !ok {\n\t\t\treturn nil, nil, fmt.Errorf(\"loaded service %T does not expose a recipe ID\", res)\n\t\t}\n\t\tdumpID, err = recipeIDable.RecipeID(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, nil, fmt.Errorf(\"failed to derive service recipe ID: %w\", err)\n\t\t}\n\t}\n\tif err := dump.DumpID(output, dumpID); err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"failed to serialize service ID: %w\", err)\n\t}\n\tfmt.Fprint(term.Stderr, dump.Newline)\n\tif execErr != nil {\n\t\tfmt.Fprintf(term.Stderr,\n\t\t\toutput.String(\"! %s\").Foreground(termenv.ANSIYellow).String(), execErr.Error())\n\t\tfmt.Fprint(term.Stderr, dump.Newline)\n\t}\n\n\treturn term, output, nil\n}\n\n// prepTerminalEnv creates a custom shell prompt `dagger:<cwd>$`\nfunc prepTerminalEnv(output *termenv.Output, env []string) []string {\n\tenv = append(env, fmt.Sprintf(\"PS1=%s %s $ \",\n\t\toutput.String(\"dagger\").Foreground(termenv.ANSIYellow).String(),\n\t\toutput.String(`$(pwd | sed \"s|^$HOME|~|\")`).Faint().String(),\n\t))\n\treturn env","sourceCodeStart":428,"sourceCodeEnd":464,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/terminal.go#L428-L464","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"id, err := recipeIDable.RecipeID(ctx)\nif err != nil {\n    return fmt.Errorf(\"terminal: derive recipe ID: %w\", err)\n}\nif err := dump.DumpID(output, id); err != nil {\n    return fmt.Errorf(\"terminal: serialize ID: %w\", err)\n}","preventionTips":["Keep CLI and engine versions in sync","Retry transient serialization failures","Include the wrapped cause in bug reports"],"tags":["serialization","terminal","dagql"],"backgroundTag":"id-serialization-failed","analyzedSha":"82ba2681dbe30d3547a1dc50ea495900ab5b6047","analyzedAt":"2026-09-05T07:21:37.930Z","contentChangedAt":"2026-09-05T07:21:37.930Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}