{"record":{"id":"fce70e4b28eeef98","repo":"GoogleContainerTools/skaffold","slug":"read-skaffold-config-w","errorCode":null,"errorMessage":"read skaffold config: %w","messagePattern":"read skaffold config: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"pkg/skaffold/schema/versions.go","lineNumber":231,"sourceCode":"\t\t}\n\t}\n\n\treturn nil, false\n}\n\n// IsSkaffoldConfig is for determining if a file is skaffold config file.\nfunc IsSkaffoldConfig(file string) bool {\n\tif config, err := ParseConfig(file); err == nil && config != nil {\n\t\treturn true\n\t}\n\treturn false\n}\n\n// ParseConfig reads a configuration file.\nfunc ParseConfig(filename string) ([]util.VersionedConfig, error) {\n\tbuf, err := misc.ReadConfiguration(filename)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"read skaffold config: %w\", err)\n\t}\n\tfactories, err := configFactoryFromAPIVersion(buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbuf, err = removeYamlAnchors(buf)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to re-marshal YAML without dotted keys: %w\", err)\n\t}\n\treturn parseConfig(buf, factories)\n}\n\n// ParseConfigAndUpgrade reads a configuration file and upgrades it to a given version.\nfunc ParseConfigAndUpgrade(filename string) ([]util.VersionedConfig, error) {\n\tconfigs, err := ParseConfig(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}","sourceCodeStart":213,"sourceCodeEnd":249,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/schema/versions.go#L213-L249","documentation":"ParseConfig wraps any failure to physically read the skaffold configuration file with this message. It is a generic wrapper (%w) around errors from misc.ReadConfiguration, so the underlying cause (missing file, permission denied, IO error) is chained after 'read skaffold config:'.","triggerScenarios":"Calling skaffold.ParseConfig(filename) when the file does not exist, is a directory, or the process lacks read permission on it.","commonSituations":"Running skaffold from a directory without skaffold.yaml; wrong --filename path; permissions changed after checkout; CI checkout missing the config file.","solutions":["Verify the file exists at the given path (ls / test -f)","Run the command from the directory containing skaffold.yaml or pass the correct --filename","Fix file permissions if the file exists but is unreadable","Inspect the wrapped cause (%w) for the exact OS error"],"exampleFix":"// before\nconfigs, err := schema.ParseConfig(cfgPath)\n// after\nif _, statErr := os.Stat(cfgPath); statErr != nil {\n\treturn fmt.Errorf(\"skaffold config %q not found: %w\", cfgPath, statErr)\n}\nconfigs, err := schema.ParseConfig(cfgPath)","handlingStrategy":"try-catch","validationCode":"if _, err := os.Stat(cfgPath); err != nil {\n\treturn fmt.Errorf(\"cannot access skaffold config %q: %w\", cfgPath, err)\n}","typeGuard":null,"tryCatchPattern":"configs, err := schema.ParseConfig(cfgPath)\nif err != nil {\n\tif errors.Is(err, os.ErrNotExist) || errors.Is(err, os.ErrPermission) {\n\t\t// resolve path/permissions before retrying\n\t}\n\treturn fmt.Errorf(\"load config: %w\", err)\n}","preventionTips":["Resolve skaffold.yaml relative to the repo root, not CWD","Check file existence in setup code before parsing","Verify CI checkout includes skaffold.yaml","Unwrap errors.Is/errors.As to inspect the root OS error"],"tags":["skaffold","config-loading","file-io"],"backgroundTag":"config-file-not-found","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"}