{"record":{"id":"eed05d57dafd704c","repo":"kubernetes/kubernetes","slug":"error-validating-source-directory-v","errorCode":null,"errorMessage":"error validating source directory: %v","messagePattern":"error validating source directory: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hack/tools/publishing-verifier/publishing-verifier.go","lineNumber":192,"sourceCode":"\tvar processedRepos []string\n\tfor _, rule := range rules.Rules {\n\t\tbranch := rule.Branches[0]\n\n\t\t// if this no longer exists in master\n\t\tif _, ok := gomodDependencies[rule.DestinationRepository]; !ok {\n\t\t\t// make sure we dont include a rule to publish it from master\n\t\t\tfor _, branch := range rule.Branches {\n\t\t\t\tif branch.Name == \"master\" {\n\t\t\t\t\terr := fmt.Errorf(\"cannot find master branch for destination `%s`\", rule.DestinationRepository)\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t}\n\t\t\t// and skip the validation of publishing rules for it\n\t\t\tcontinue\n\t\t}\n\n\t\tif err := checkValidSourceDirectory(rule); err != nil {\n\t\t\treturn fmt.Errorf(\"error validating source directory: %v\", err)\n\t\t}\n\n\t\tif err := checkMasterBranch(rule); err != nil {\n\t\t\treturn fmt.Errorf(\"error validating master branch: %v\", err)\n\t\t}\n\n\t\t// we specify the go version for all master branches through `default-go-version`\n\t\t// so ensure we don't specify explicit go version for master branch in rules\n\t\tif branch.GoVersion != \"\" {\n\t\t\terr := fmt.Errorf(\"go version must not be specified for master branch for destination `%s`\", rule.DestinationRepository)\n\t\t\tpanic(err)\n\t\t}\n\n\t\tfmt.Printf(\"processing : %s\", rule.DestinationRepository)\n\t\tif _, ok := gomodDependencies[rule.DestinationRepository]; !ok {\n\t\t\terr := fmt.Errorf(\"missing go.mod for `%s`\", rule.DestinationRepository)\n\t\t\tpanic(err)\n\t\t}","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/kubernetes/kubernetes/blob/94c136764292cc5fac976c0de6587daaea56410f/hack/tools/publishing-verifier/publishing-verifier.go#L174-L210","documentation":"verifyPublishingBotRules (publishing-verifier.go:191-192) wraps the error from checkValidSourceDirectory with this prefix. The real cause is one of the source-directory checks (deprecated dir field, multiple dirs, or copy/paste suffix mismatch). The %v is the wrapped inner error.","triggerScenarios":"Any failure inside checkValidSourceDirectory for a rule: branch.Source.Dir set, more than one source dir, or a dir path not ending in the destination repository name.","commonSituations":"Same root causes as errors 500/501/502; this wrapper appears in CI logs before the inner message.","solutions":["Read the inner message after the colon to identify which of 500/501/502 fired and apply that fix.","Run the verifier locally to see the full wrapped chain clearly.","After fixing the underlying source-directory issue, re-run to confirm the wrapper disappears."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Pre-flight: run all source-directory checks before the verifier does.\n// Reuse the checkValidSourceDirectory logic (errors 500/501/502) on each rule\n// and report a precise message instead of the generic wrapper.\nfunc preflightSourceDir(rules []RepositoryRule) error {\n    for _, r := range rules {\n        if err := checkValidSourceDirectory(r); err != nil {\n            return err\n        }\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"// Unwrap to surface the precise inner cause for logging:\nif err := verifyPublishingBotRules(); err != nil {\n    fmt.Fprintf(os.Stderr, \"source-directory validation failed: %v\\n\", err)\n}","preventionTips":["Read past the 'error validating source directory:' prefix to the inner message.","Fix the underlying 500/501/502 condition rather than the wrapper."],"tags":["config","publishing-bot","kubernetes","wrapper","validation"],"backgroundTag":null,"analyzedSha":"94c136764292cc5fac976c0de6587daaea56410f","analyzedAt":"2026-08-08T23:58:27.554Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}