dagger/dagger · error

unknown telemetry stream %q

Error message

unknown telemetry stream %q

What it means

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.

Source

Thrown at engine/clientdb/dump.go:46

		if selection != DumpAll && selection != stream {
			continue
		}
		path := filepath.Join(root, clientID+"."+stream+".log")
		var err error
		switch stream {
		case DumpSpans:
			err = dumpFile(ctx, path, stream, spanCodec, encoder)
		case DumpLogs:
			err = dumpFile(ctx, path, stream, logCodec, encoder)
		case DumpMetrics:
			err = dumpFile(ctx, path, stream, metricCodec, encoder)
		}
		if err != nil {
			return err
		}
	}
	if selection != DumpAll && selection != DumpSpans && selection != DumpLogs && selection != DumpMetrics {
		return fmt.Errorf("unknown telemetry stream %q", selection)
	}
	return nil
}

func dumpFile[Row any](ctx context.Context, path, stream string, codec rowCodec[Row], encoder *json.Encoder) (rerr error) {
	file, err := os.Open(path)
	if err != nil {
		return fmt.Errorf("open %s stream: %w", stream, err)
	}
	defer func() { rerr = errors.Join(rerr, file.Close()) }()

	info, err := file.Stat()
	if err != nil {
		return fmt.Errorf("stat %s stream: %w", stream, err)
	}
	if info.Size() < 1 {
		return fmt.Errorf("%s stream has no format header", stream)
	}

View on GitHub (pinned to 82ba2681db)

Solutions

  1. Pass one of the exported constants: clientdb.DumpAll, DumpSpans, DumpLogs, DumpMetrics, or "" for all
  2. Fix the spelling of the selection string (note it is plural: "spans", "logs", "metrics")
  3. Validate/whitelist the selection in your CLI layer before calling Dump

Example fix

// before
clientdb.Dump(ctx, root, id, "span", out)
// after
clientdb.Dump(ctx, root, id, clientdb.DumpSpans, out)
Defensive patterns

Strategy: validation

Validate before calling

func validSelection(s string) bool {
    switch s {
    case "", clientdb.DumpAll, clientdb.DumpSpans, clientdb.DumpLogs, clientdb.DumpMetrics:
        return true
    }
    return false
}
// if !validSelection(sel) { return fmt.Errorf("invalid stream %q", sel) }

Try / catch

if err := clientdb.Dump(ctx, root, clientID, sel, out); err != nil {
    if strings.HasPrefix(err.Error(), "unknown telemetry stream") { /* fix selection */ }
    return err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05). Data as JSON: /api/errors/66bd96cb2a1f6fcd. Report an issue: GitHub.