{"record":{"id":"34738b428c67780d","repo":"GoogleContainerTools/skaffold","slug":"filename-not-specified","errorCode":null,"errorMessage":"filename not specified","messagePattern":"filename not specified","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/util/config.go","lineNumber":41,"sourceCode":"\t\"os\"\n\t\"path/filepath\"\n\n\t\"github.com/spf13/afero\"\n\n\t\"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/output/log\"\n)\n\n// Fs is the underlying filesystem to use for reading skaffold project files & configuration.  OS FS by default\nvar Fs = afero.NewOsFs()\n\nvar stdin []byte\n\n// ReadConfiguration reads a `skaffold.yaml` configuration and\n// returns its content.\nfunc ReadConfiguration(filePath string) ([]byte, error) {\n\tswitch {\n\tcase filePath == \"\":\n\t\treturn nil, errors.New(\"filename not specified\")\n\tcase filePath == \"-\":\n\t\tif len(stdin) == 0 {\n\t\t\tvar err error\n\t\t\tstdin, err = io.ReadAll(os.Stdin)\n\t\t\tif err != nil {\n\t\t\t\treturn []byte{}, err\n\t\t\t}\n\t\t}\n\t\treturn stdin, nil\n\tcase IsURL(filePath):\n\t\treturn Download(filePath)\n\tdefault:\n\t\tif !filepath.IsAbs(filePath) {\n\t\t\tdir, err := os.Getwd()\n\t\t\tif err != nil {\n\t\t\t\treturn []byte{}, err\n\t\t\t}\n\t\t\tfilePath = filepath.Join(dir, filePath)","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/util/config.go#L23-L59","documentation":"ReadConfiguration loads a skaffold.yaml from a path, stdin (\"-\"), or a remote URL. An empty filePath gives it nothing to read, so it immediately returns \"filename not specified\" before any I/O. It guards the API against callers that skip the -f/--filename resolution step.","triggerScenarios":"Calling util.ReadConfiguration(\"\") programmatically (e.g. from buildMapOfSchemaObjPointerToYAMLInfos or tests); skaffold invoked without -f and the caller failed to apply the default \"skaffold.yaml\" before this low-level call.","commonSituations":"Custom tooling or tests invoking the config-reading API directly with an unset variable; refactors that dropped the default-filename fallback; passing an os.Getenv result that is empty.","solutions":["Pass a concrete path, e.g. util.ReadConfiguration(\"skaffold.yaml\").","Apply the default filename at the call site when the flag/env is empty (opts.ConfigurationFile defaults to skaffold.yaml in the CLI).","Use \"-\" to read from stdin or an http(s) URL for remote configs.","Check that the variable feeding filePath is actually populated (log it before the call)."],"exampleFix":"// before\ncfg, err := util.ReadConfiguration(configPath) // configPath == \"\"\n// after\nif configPath == \"\" {\n    configPath = \"skaffold.yaml\"\n}\ncfg, err := util.ReadConfiguration(configPath)","handlingStrategy":"validation","validationCode":"if (!filePath) throw new Error('skaffold config file path is required');","typeGuard":null,"tryCatchPattern":"let cfg;\ntry {\n  cfg = await util.ReadConfiguration(filePath);\n} catch (e) {\n  if (e.message === 'filename not specified') {\n    cfg = await util.ReadConfiguration('skaffold.yaml');\n  } else throw e;\n}","preventionTips":["Default to 'skaffold.yaml' when the -f flag/env is empty","Guard programmatic callers with an explicit empty-string check","Use '-' or a URL intentionally, never an empty string"],"tags":["skaffold","config","input-validation"],"backgroundTag":"missing-required-argument","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"}