{"record":{"id":"fc25b6f7826574ff","repo":"gohugoio/hugo","slug":"q-is-not-a-valid-placeholder-valid-values-are-c","errorCode":null,"errorMessage":"%q is not a valid placeholder (valid values are :cacheDir or :resourceDir)","messagePattern":"%q is not a valid placeholder \\(valid values are :cacheDir or :resourceDir\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cache/filecache/filecache_config.go","lineNumber":316,"sourceCode":"\n\t\tc[k] = v\n\t}\n\n\treturn c, nil\n}\n\n// Resolves :resourceDir => /myproject/resources etc., :cacheDir => ...\nfunc resolveDirPlaceholder(fs afero.Fs, bcfg config.BaseConfig, placeholder string) (cacheDir string, isResource bool, err error) {\n\tswitch strings.ToLower(placeholder) {\n\tcase \":resourcedir\":\n\t\treturn \"\", true, nil\n\tcase \":cachedir\":\n\t\treturn bcfg.CacheDir, false, nil\n\tcase \":project\":\n\t\treturn filepath.Base(bcfg.WorkingDir), false, nil\n\t}\n\n\treturn \"\", false, fmt.Errorf(\"%q is not a valid placeholder (valid values are :cacheDir or :resourceDir)\", placeholder)\n}\n","sourceCodeStart":298,"sourceCodeEnd":318,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/cache/filecache/filecache_config.go#L298-L318","documentation":"Cache dir paths may contain only three placeholders: :cacheDir, :resourceDir, and :project (filecache_config.go:306-316). resolveDirPlaceholder rejects any other colon-prefixed token. Note matching is case-insensitive (:resourceDir and :resourcedir both work).","triggerScenarios":"Using an unsupported placeholder like :themes, :temp, :workingDir, or a typo like :cacheDirr in a cache dir string.","commonSituations":"Guessing placeholder names from other Hugo concepts; typos; copy-paste errors from outdated docs.","solutions":["Use only :cacheDir, :resourceDir, or :project","Replace the invalid placeholder with a literal absolute path","Check for typos in the placeholder spelling (case-insensitive but spelling must match)"],"exampleFix":"# before\ndir = \":themes/cache\"\n# after\ndir = \":cacheDir/themes\"","handlingStrategy":"validation","validationCode":"// Validate placeholders in cache dir strings.\nvar validPlaceholders = []string{\":cachedir\", \":resourcedir\", \":project\"}\nfunc validatePlaceholders(dir string) error {\n    for _, part := range strings.Split(dir, \"/\") {\n        if strings.HasPrefix(part, \":\") {\n            if !slices.Contains(validPlaceholders, strings.ToLower(part)) {\n                return fmt.Errorf(\"%q is not a valid placeholder\", part)\n            }\n        }\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use only :cacheDir, :resourceDir, :project in cache dir config","Prefer :cacheDir and :resourceDir over literal paths for portability","Double-check placeholder spelling (case-insensitive but exact)"],"tags":["cache","filecache","config","placeholder","validation","hugo"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}