kubernetes/kubernetes · error
error validating source directory: %v
Error message
error validating source directory: %v
What it means
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.
Source
Thrown at hack/tools/publishing-verifier/publishing-verifier.go:192
var processedRepos []string
for _, rule := range rules.Rules {
branch := rule.Branches[0]
// if this no longer exists in master
if _, ok := gomodDependencies[rule.DestinationRepository]; !ok {
// make sure we dont include a rule to publish it from master
for _, branch := range rule.Branches {
if branch.Name == "master" {
err := fmt.Errorf("cannot find master branch for destination `%s`", rule.DestinationRepository)
panic(err)
}
}
// and skip the validation of publishing rules for it
continue
}
if err := checkValidSourceDirectory(rule); err != nil {
return fmt.Errorf("error validating source directory: %v", err)
}
if err := checkMasterBranch(rule); err != nil {
return fmt.Errorf("error validating master branch: %v", err)
}
// we specify the go version for all master branches through `default-go-version`
// so ensure we don't specify explicit go version for master branch in rules
if branch.GoVersion != "" {
err := fmt.Errorf("go version must not be specified for master branch for destination `%s`", rule.DestinationRepository)
panic(err)
}
fmt.Printf("processing : %s", rule.DestinationRepository)
if _, ok := gomodDependencies[rule.DestinationRepository]; !ok {
err := fmt.Errorf("missing go.mod for `%s`", rule.DestinationRepository)
panic(err)
}View on GitHub (pinned to 94c1367642)
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.
Defensive patterns
Strategy: validation
Validate before calling
// Pre-flight: run all source-directory checks before the verifier does.
// Reuse the checkValidSourceDirectory logic (errors 500/501/502) on each rule
// and report a precise message instead of the generic wrapper.
func preflightSourceDir(rules []RepositoryRule) error {
for _, r := range rules {
if err := checkValidSourceDirectory(r); err != nil {
return err
}
}
return nil
} Try / catch
// Unwrap to surface the precise inner cause for logging:
if err := verifyPublishingBotRules(); err != nil {
fmt.Fprintf(os.Stderr, "source-directory validation failed: %v\n", err)
} Prevention
- Read past the 'error validating source directory:' prefix to the inner message.
- Fix the underlying 500/501/502 condition rather than the wrapper.
When it happens
Trigger: 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.
Common situations: Same root causes as errors 500/501/502; this wrapper appears in CI logs before the inner message.
Related errors
- error validating master branch: %v
- error validating dependencies: %v
- cannot have more than one directory (%s) per source branch `
- empty hostname-override is invalid
- failed validate: %w
AI-assisted analysis of kubernetes/kubernetes@94c1367642 (2026-08-08).
Data as JSON: /api/errors/eed05d57dafd704c.
Report an issue: GitHub.