{"record":{"id":"66bd96cb2a1f6fcd","repo":"dagger/dagger","slug":"unknown-telemetry-stream-q","errorCode":null,"errorMessage":"unknown telemetry stream %q","messagePattern":"unknown telemetry stream %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/clientdb/dump.go","lineNumber":46,"sourceCode":"\t\tif selection != DumpAll && selection != stream {\n\t\t\tcontinue\n\t\t}\n\t\tpath := filepath.Join(root, clientID+\".\"+stream+\".log\")\n\t\tvar err error\n\t\tswitch stream {\n\t\tcase DumpSpans:\n\t\t\terr = dumpFile(ctx, path, stream, spanCodec, encoder)\n\t\tcase DumpLogs:\n\t\t\terr = dumpFile(ctx, path, stream, logCodec, encoder)\n\t\tcase DumpMetrics:\n\t\t\terr = dumpFile(ctx, path, stream, metricCodec, encoder)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif selection != DumpAll && selection != DumpSpans && selection != DumpLogs && selection != DumpMetrics {\n\t\treturn fmt.Errorf(\"unknown telemetry stream %q\", selection)\n\t}\n\treturn nil\n}\n\nfunc dumpFile[Row any](ctx context.Context, path, stream string, codec rowCodec[Row], encoder *json.Encoder) (rerr error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"open %s stream: %w\", stream, err)\n\t}\n\tdefer func() { rerr = errors.Join(rerr, file.Close()) }()\n\n\tinfo, err := file.Stat()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"stat %s stream: %w\", stream, err)\n\t}\n\tif info.Size() < 1 {\n\t\treturn fmt.Errorf(\"%s stream has no format header\", stream)\n\t}","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/engine/clientdb/dump.go#L28-L64","documentation":"Dump validates the requested telemetry stream selection after iterating streams; only \"all\", \"spans\", \"logs\", and \"metrics\" (empty string defaults to \"all\") are accepted. If the selection matches none, the function returns this error instead of dumping anything. It is a pure input-validation error thrown by the public Dump entry point.","triggerScenarios":"Calling clientdb.Dump(ctx, root, clientID, selection, out) with any selection string other than \"\", \"all\", \"spans\", \"logs\", or \"metrics\" — e.g. a typo like \"span\" or \"trace\". Because the check runs after the loop, an invalid-but-nonempty name skips all streams and then fails here.","commonSituations":"Typo in a CLI flag value wiring into Dump, passing a user-supplied stream name unvalidated, mixing up Dump's constants (DumpAll/DumpSpans/DumpLogs/DumpMetrics) with other stream names.","solutions":["Pass one of the exported constants: clientdb.DumpAll, DumpSpans, DumpLogs, DumpMetrics, or \"\" for all","Fix the spelling of the selection string (note it is plural: \"spans\", \"logs\", \"metrics\")","Validate/whitelist the selection in your CLI layer before calling Dump"],"exampleFix":"// before\nclientdb.Dump(ctx, root, id, \"span\", out)\n// after\nclientdb.Dump(ctx, root, id, clientdb.DumpSpans, out)","handlingStrategy":"validation","validationCode":"func validSelection(s string) bool {\n    switch s {\n    case \"\", clientdb.DumpAll, clientdb.DumpSpans, clientdb.DumpLogs, clientdb.DumpMetrics:\n        return true\n    }\n    return false\n}\n// if !validSelection(sel) { return fmt.Errorf(\"invalid stream %q\", sel) }","typeGuard":null,"tryCatchPattern":"if err := clientdb.Dump(ctx, root, clientID, sel, out); err != nil {\n    if strings.HasPrefix(err.Error(), \"unknown telemetry stream\") { /* fix selection */ }\n    return err\n}","preventionTips":["Always use the exported constants DumpAll/DumpSpans/DumpLogs/DumpMetrics instead of raw strings","Validate CLI flag values against the allowed set before calling Dump","Remember empty string means all streams"],"tags":["go","validation","telemetry","cli"],"backgroundTag":"invalid-argument-value","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"}