GoogleContainerTools/skaffold · error
unable to re-marshal YAML without dotted keys: %w
Error message
unable to re-marshal YAML without dotted keys: %w
What it means
During parsing, Skaffold re-marshals the YAML after removing anchors/dotted keys so downstream decoders see normalized YAML. If that re-marshal step fails, ParseConfig returns this wrapped error. It indicates the YAML round-trip could not be serialized, usually due to unsupported constructs produced by the decode step.
Source
Thrown at pkg/skaffold/schema/versions.go:239
if config, err := ParseConfig(file); err == nil && config != nil {
return true
}
return false
}
// ParseConfig reads a configuration file.
func ParseConfig(filename string) ([]util.VersionedConfig, error) {
buf, err := misc.ReadConfiguration(filename)
if err != nil {
return nil, fmt.Errorf("read skaffold config: %w", err)
}
factories, err := configFactoryFromAPIVersion(buf)
if err != nil {
return nil, err
}
buf, err = removeYamlAnchors(buf)
if err != nil {
return nil, fmt.Errorf("unable to re-marshal YAML without dotted keys: %w", err)
}
return parseConfig(buf, factories)
}
// ParseConfigAndUpgrade reads a configuration file and upgrades it to a given version.
func ParseConfigAndUpgrade(filename string) ([]util.VersionedConfig, error) {
configs, err := ParseConfig(filename)
if err != nil {
return nil, err
}
return UpgradeTo(configs, latest.Version)
}
// configFactoryFromAPIVersion checks that all configs in the input stream have the same API version, and returns a function to create a config with that API version.
func configFactoryFromAPIVersion(buf []byte) ([]func() util.VersionedConfig, error) {
// This is to quickly check that it's possibly a skaffold.yaml,
// without parsing the whole file.View on GitHub (pinned to a1189de023)
Solutions
- Simplify the YAML in skaffold.yaml: remove dotted keys and non-standard constructs
- Replace YAML anchors/merge keys with explicit values to avoid the rewrite path
- Bisect by halving the config file to find the offending document/section
- Inspect the wrapped cause (%w) for the marshal error detail
Example fix
# before (dotted key) .x-custom: value apiVersion: skaffold/v4beta7 # after apiVersion: skaffold/v4beta7
Defensive patterns
Strategy: try-catch
Try / catch
configs, err := schema.ParseConfig(cfgPath)
if err != nil {
var reErr *fmt.Errorf
if strings.Contains(err.Error(), "re-marshal YAML without dotted keys") {
// simplify YAML: remove dotted keys/anchors, then retry once
}
return err
} Prevention
- Avoid dotted top-level keys and exotic YAML constructs in skaffold.yaml
- Prefer explicit values over anchors/merge keys
- Keep a canonical, lint-clean skaffold.yaml
When it happens
Trigger: Calling ParseConfig on a file whose YAML, after removeYamlAnchors processing, cannot be re-marshaled — e.g. exotic key types or constructs the marshal step cannot represent.
Common situations: Highly unusual YAML in skaffold.yaml (odd key types, corrupt encoding); a bug/edge case in the anchor-removal pipeline triggered by unusual document structure.
Related errors
- parsing api version: %w
- unable to parse YAML: %w
- read skaffold config: %w
- `apply` requires at least one manifest argument
- `exec` requires exactly one action to execute
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/e8c46302c4288ae8.
Report an issue: GitHub.