GoogleContainerTools/skaffold · error
Unknown artifact
Error message
Unknown artifact
What it means
diagnose.typeOfArtifact panics "Unknown artifact" when an *latest.Artifact has none of the known artifact-type fields set (custom, buildpack, ko, etc.). The skaffold config schema guarantees exactly one artifact type, so a nil-everything artifact indicates a deserialization or schema bug rather than expected user input.
Source
Thrown at pkg/skaffold/diagnose/diagnose.go:124
func typeOfArtifact(a *latest.Artifact) string {
switch {
case a.DockerArtifact != nil:
return "Docker artifact"
case a.BazelArtifact != nil:
return "Bazel artifact"
case a.JibArtifact != nil:
return "Jib artifact"
case a.KanikoArtifact != nil:
return "Kaniko artifact"
case a.CustomArtifact != nil:
return "Custom artifact"
case a.BuildpackArtifact != nil:
return "Buildpack artifact"
case a.KoArtifact != nil:
return "Ko artifact"
default:
panic("Unknown artifact")
}
}
func timeToListDependencies(ctx context.Context, a *latest.Artifact, tag string, cfg Config) (string, []string, error) {
start := time.Now()
g := graph.ToArtifactGraph(cfg.Artifacts())
sourceDependencies := graph.NewSourceDependenciesCache(cfg, nil, g)
paths, err := sourceDependencies.SingleArtifactDependencies(ctx, a, tag)
return timeutil.Humanize(time.Since(start)), paths, err
}
func timeToConstructSyncMap(ctx context.Context, a *latest.Artifact, cfg docker.Config) (string, error) {
start := time.Now()
_, err := sync.SyncMap(ctx, a, cfg)
return timeutil.Humanize(time.Since(start)), err
}
func timeToComputeMTimes(deps []string) (string, error) {View on GitHub (pinned to a1189de023)
Solutions
- Ensure every artifact in skaffold.yaml sets exactly one builder type (docker, custom, buildpacks, ko, ...)
- Validate config with `skaffold diagnose` or `skaffold config` / schema validation before building
- If you added a new artifact type, add a case for it in typeOfArtifact
- Check skaffold version compatibility with the skaffold.yaml apiVersion
Example fix
// before (skaffold.yaml)
artifacts:
- image: myimg
// after
artifacts:
- image: myimg
docker:
dockerfile: Dockerfile Defensive patterns
Strategy: validation
Validate before calling
func artifactTypeSet(a *latest.Artifact) error {
t := a.ArtifactType
if t == nil || (t.CustomArtifact == nil && t.BuildpackArtifact == nil && t.KoArtifact == nil && t.DockerArtifact == nil) {
return fmt.Errorf("artifact %q has no builder type set", a.ImageName)
}
return nil
} Type guard
func hasKnownType(a *latest.Artifact) bool {
return a != nil && a.ArtifactType != nil &&
(a.ArtifactType.CustomArtifact != nil || a.ArtifactType.BuildpackArtifact != nil ||
a.ArtifactType.KoArtifact != nil || a.ArtifactType.DockerArtifact != nil)
} Try / catch
func safeTypeOf(a *latest.Artifact) (s string) {
defer func() { if recover() != nil { s = "unknown artifact" } }()
return typeOfArtifact(a)
} Prevention
- Always set exactly one builder per artifact in skaffold.yaml
- Run `skaffold diagnose` / schema validation in CI
- When adding a new artifact type, update every exhaustive switch (typeOfArtifact included)
When it happens
Trigger: CheckArtifacts calls typeOfArtifact with an Artifact produced from config where the ArtifactType union discriminated field was never set — e.g. hand-constructed structs in tests/code, or a new artifact type added to the schema but not to typeOfArtifact's switch.
Common situations: Running `skaffold diagnose` on a skaffold.yaml parsed with a newer/older schema version where a type field is dropped; a newly added builder (e.g. a new artifact kind) missing from the switch; programmatic config building that left ArtifactType nil.
Related errors
- CONFIG_UNKNOWN_API_VERSION_ERR
- the following versions are incompatible with target version
- transforming skaffold config: %w
- unsupported prefix:
- bucket name is empty
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/151c444f3eb9c5cc.
Report an issue: GitHub.