{"record":{"id":"ba9a196e37d632e6","repo":"GoogleContainerTools/skaffold","slug":"build-target-platforms-q-do-not-match-platform-co","errorCode":null,"errorMessage":"build target platforms %q do not match platform constraints %q defined for artifact %q","messagePattern":"build target platforms %q do not match platform constraints %q defined for artifact %q","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/platform/resolver.go","lineNumber":110,"sourceCode":"\t\t\t\tplatforms = fromClusterNodes\n\t\t\t} else if p := platforms.Intersect(fromClusterNodes); p.IsNotEmpty() {\n\t\t\t\tplatforms = p\n\t\t\t} else {\n\t\t\t\tlog.Entry(ctx).Warnf(\"build target platforms %q do not match active kubernetes cluster node platforms %q\", platforms, fromClusterNodes)\n\t\t\t}\n\t\t}\n\t\tinstrumentation.AddResolvedBuildTargetPlatforms(platforms.String())\n\t\tfor _, artifact := range pipeline.Build.Artifacts {\n\t\t\tpl := platforms\n\t\t\tconstraints, err := Parse(artifact.Platforms)\n\t\t\tif err != nil {\n\t\t\t\treturn r, fmt.Errorf(\"failed to parse platforms: %w\", err)\n\t\t\t}\n\t\t\tif constraints.IsNotEmpty() {\n\t\t\t\tif pl.IsEmpty() {\n\t\t\t\t\tpl = constraints\n\t\t\t\t} else if pl = pl.Intersect(constraints); pl.IsEmpty() {\n\t\t\t\t\treturn r, fmt.Errorf(\"build target platforms %q do not match platform constraints %q defined for artifact %q\", platforms, artifact.Platforms, artifact.ImageName)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif pl.IsMultiPlatform() && opts.DisableMultiPlatformBuild {\n\t\t\t\tpl = selectOnePlatform(pl)\n\t\t\t}\n\t\t\tr.platformsByImageName[artifact.ImageName] = pl\n\t\t\tlog.Entry(ctx).Debugf(\"platforms selected for artifact %q: %q\", artifact.ImageName, pl)\n\t\t}\n\t}\n\treturn r, nil\n}\n\n// GetClusterPlatforms returns the platforms for the active kubernetes cluster.\nfunc GetClusterPlatforms(ctx context.Context, kContext string) (Matcher, error) {\n\tclient, err := kubernetesclient.Client(kContext)\n\tif err != nil {\n\t\treturn Matcher{}, fmt.Errorf(\"failed to determine kubernetes cluster node platforms: %w\", err)\n\t}","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/platform/resolver.go#L92-L128","documentation":"NewResolver returns this error when the resolved build target platforms have an empty intersection with the platform constraints declared on a specific artifact, i.e. the requested targets include no platform the artifact supports. It is a semantic mismatch check (not a parse failure) done after platforms.Intersect(constraints) yields an empty set.","triggerScenarios":"Running skaffold with --platform linux/amd64 (or build.platforms) while an artifact declares only e.g. linux/arm64, so Intersect returns empty and the error names the target platforms, artifact constraints, and image name.","commonSituations":"Building on/for the wrong architecture (Apple Silicon host targeting amd64 while artifacts restrict to arm64); CI matrix passing platform values that drifted from artifact constraints; adding a new artifact with restrictive platforms without updating the shared --platform flag.","solutions":["Align the artifact's `platforms` constraints in skaffold.yaml with the requested target platforms (add the missing platform, e.g. linux/amd64).","Change the --platform flag / build.platforms to values that intersect the artifact constraints.","Remove the artifact-level `platforms` restriction so the artifact inherits the global targets.","Read the error message: it echoes both %q platform sets and the artifact ImageName to pinpoint the mismatch."],"exampleFix":"// before (--platform linux/amd64, artifact restricted)\nartifacts:\n  - image: myapp\n    platforms: [linux/arm64]\n// after\nartifacts:\n  - image: myapp\n    platforms: [linux/amd64, linux/arm64]","handlingStrategy":"validation","validationCode":"const targets = new Set(cliPlatforms ?? pipeline.build?.platforms ?? []);\nfor (const a of pipeline.build?.artifacts ?? []) {\n  if (a.platforms?.length && !a.platforms.some(p => targets.has(p))) {\n    throw new Error(`artifact ${a.image}: no overlap between targets ${[...targets]} and constraints ${a.platforms}`);\n  }\n}","typeGuard":"function platformsMatch(targets, constraints) {\n  return !constraints?.length || constraints.some(c => targets.includes(c));\n}","tryCatchPattern":"r, err := platform.NewResolver(ctx, opts, pipelines, fromClusterNodes)\nif err != nil {\n  if strings.Contains(err.Error(), \"do not match platform constraints\") {\n    return fmt.Errorf(\"fix --platform or artifact constraints; see skaffold.yaml: %w\", err)\n  }\n  return err\n}","preventionTips":["Maintain a single source of truth for supported platforms and derive both --platform values and artifact constraints from it.","When adding artifacts with restrictive platforms, update CI build matrix simultaneously.","Document host-arch assumptions (e.g. Apple Silicon) and set constraints accordingly.","Run a config preflight script that checks intersection of build.platforms with each artifact's platforms."],"tags":["skaffold","platform-mismatch","config-validation","artifacts"],"backgroundTag":"platform-constraint-mismatch","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}