GoogleContainerTools/skaffold · error
invalid log prefix '%s'. Valid values are 'auto', 'container
Error message
invalid log prefix '%s'. Valid values are 'auto', 'container', 'podAndContainer' or 'none'
What it means
The deploy.logs.prefix field controls how pod/container names are prefixed in Skaffold's log output. Only '', 'auto', 'container', 'podAndContainer', and 'none' are accepted; any other string fails validation.
Source
Thrown at pkg/skaffold/schema/validation/validation.go:698
if bc.GoogleCloudBuild != nil && bc.GoogleCloudBuild.WorkerPool != "" {
if !gcbWorkerPoolPattern.MatchString(bc.GoogleCloudBuild.WorkerPool) {
cfgErrs = append(cfgErrs, ErrorWithLocation{
Error: fmt.Errorf("invalid value for worker pool. Must match pattern projects/{project}/locations/{location}/workerPools/{worker_pool}"),
Location: cfg.YAMLInfos.Locate(&cfg.Build.GoogleCloudBuild.WorkerPool),
})
}
}
return cfgErrs
}
// validateLogPrefix checks that logs are configured with a valid prefix.
func validateLogPrefix(cfg *parser.SkaffoldConfigEntry, lc latest.LogsConfig) []ErrorWithLocation {
validPrefixes := []string{"", "auto", "container", "podAndContainer", "none"}
if !stringslice.Contains(validPrefixes, lc.Prefix) {
return []ErrorWithLocation{
{
Error: fmt.Errorf("invalid log prefix '%s'. Valid values are 'auto', 'container', 'podAndContainer' or 'none'", lc.Prefix),
Location: cfg.YAMLInfos.Locate(&cfg.Deploy.Logs),
},
}
}
return nil
}
// validateVerifyTests
// - makes sure that each test name is unique
// - makes sure that each container name is unique
func validateVerifyTests(runCtx *runcontext.RunContext) []error {
var errs []error
seenTestName := map[string]bool{}
seenContainerName := map[string]bool{}
tcs := []*latest.VerifyTestCase{}
for _, pipeline := range runCtx.GetPipelines() {
tcs = append(tcs, pipeline.Verify...)View on GitHub (pinned to a1189de023)
Solutions
- Set prefix to one of 'auto', 'container', 'podAndContainer', or 'none'
- Remove the deploy.logs.prefix field to accept the default ('auto')
Example fix
# before
deploy:
logs:
prefix: pod
# after
deploy:
logs:
prefix: podAndContainer Defensive patterns
Strategy: validation
Validate before calling
const valid = ['', 'auto', 'container', 'podAndContainer', 'none'];
const p = config.deploy?.logs?.prefix;
if (p !== undefined && !valid.includes(p)) throw new Error(`invalid log prefix '${p}'`); Type guard
function hasValidLogPrefix(cfg) {
const p = cfg?.deploy?.logs?.prefix;
return p === undefined || ['', 'auto', 'container', 'podAndContainer', 'none'].includes(p);
} Try / catch
try {
await skaffold.dev(config);
} catch (e) {
if (/invalid log prefix/.test(e.message)) {
console.error('Use one of: auto, container, podAndContainer, none');
} else throw e;
} Prevention
- Treat logs.prefix as an enum; never free-form text
- Omit the field when unsure (defaults to auto)
- Add enum checks to your skaffold.yaml linting
When it happens
Trigger: deploy.logs.prefix set to an unsupported value (e.g. 'pod', 'full', 'true') processed via ProcessToErrorWithLocation -> validateLogPrefix.
Common situations: Guessing the prefix value instead of using documented enum values, or migrating from another tool's log config keys.
Related errors
- verify command expects non-zero number of test cases
- CONFIG_MISSING_MANIFEST_FILE_ERR
- INIT_CLOUD_RUN_LOCATION_ERROR
- missing apiVersion
- custom tag not provided
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/ac0f5c0152e7d340.
Report an issue: GitHub.