grafana/k6 · error
unhandled extension type: %s
Error message
unhandled extension type: %s
What it means
versionDetailsWithExtensions classifies every registered extension by ext.Type into known kinds (OutputExtension, JSExtension, SecretSourceExtension, SubcommandExtension). The default branch is a forward-compatibility guard: if a binary registers an extension with a type this k6 build does not know, it returns "unhandled extension type: <type>" instead of silently dropping it from version details.
Source
Thrown at internal/cmd/version.go:205
Version: e.Version,
}
infoMap[key] = info
infoList = append(infoList, info)
}
switch e.Type {
case ext.OutputExtension:
info.Outputs = append(info.Outputs, e.Name)
case ext.JSExtension:
info.Imports = append(info.Imports, e.Name)
case ext.SecretSourceExtension:
// currently, no special handling is needed for secret source extensions
case ext.SubcommandExtension:
// currently, no special handling is needed for subcommand extensions
default:
// report unhandled extension type for future proofing
return details, fmt.Errorf("unhandled extension type: %s", e.Type)
}
}
details["extensions"] = infoList
return details, nil
}
type versionCmd struct {
gs *state.GlobalState
isJSON bool
}
func (c *versionCmd) run(cmd *cobra.Command, _ []string) error {
if !c.isJSON {
root := cmd.Root()
root.SetArgs([]string{"--version"})
_ = root.Execute()View on GitHub (pinned to 93accf6570)
Solutions
- Rebuild/upgrade so the k6 core handles the new extension type — add the case to internal/cmd/version.go upstream
- For embedders, register only supported types (Output, JS, SecretSource, Subcommand) against the vendored k6
- File an issue upstream if the unknown type comes from an official extension
Example fix
// before (embedding k6, registers an unknown kind) ext.Register(ext.NewExtension(myUnknownKind, "myext", nil)) // after ext.Register(ext.NewExtension(ext.JSExtension, "myext", myModule)) // use a known ext.Type
Defensive patterns
Strategy: type-guard
Type guard
// Exhaustive guard for extension types before building version details
func knownExtensionType(t ext.Type) bool {
switch t {
case ext.OutputExtension, ext.JSExtension, ext.SecretSourceExtension, ext.SubcommandExtension:
return true
default:
return false
}
} Prevention
- Build k6 core and extensions from the same source tree/version
- When adding a new extension kind, extend internal/cmd/version.go in the same change
- Register only supported ext.Type values when embedding k6
When it happens
Trigger: A custom xk6 build or embedded k6 registering an ext.Type outside the four handled cases (e.g. a newly introduced extension kind compiled against a different k6 core); version skew between the extension registrar and internal/cmd/version.go.
Common situations: k6 forks adding a new extension category without updating the version command; pre-release extension types used with an older vendored k6; embedding k6 as a library and registering custom extension kinds.
Related errors
- failed to get version details with extensions: %w
- unsupported extension type: %T
- extension already registered: %s
- Error while parsing selector `${selector}` - cannot use ${op
- failed to encode/output version details: %w
AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15).
Data as JSON: /api/errors/4008319fb7ace986.
Report an issue: GitHub.