{"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/8a468df065a75c1c7cf9f6850f32148746590ea5/cache/filecache/filecache_config.go#L298-L318","documentation":"Returned by resolveDirPlaceholder when a path segment in a cache dir starts with ':' but is not one of the recognized placeholders :resourceDir, :cacheDir, or :project (compared case-insensitively). Any colon-prefixed segment is treated as a placeholder, so unknown tokens are rejected rather than silently written as literal directory names. Note the message lists only :cacheDir and :resourceDir even though :project is also accepted.","triggerScenarios":"caches.<name>.dir containing a segment like `:cachedirr`, `:tmpDir`, `:home`, or any misspelled/unsupported colon token; the check runs per '/'-separated segment during DecodeConfig.","commonSituations":"Typos in placeholder names, copying placeholder syntax from other tools (e.g. `:tmp`), or expecting env-var-style tokens to work; Windows users sometimes hit adjacent path/colon confusion when hand-writing dirs.","solutions":["Correct the placeholder to :cacheDir, :resourceDir, or :project (case-insensitive).","If you meant a literal directory, remove the leading colon or use an absolute path.","For temp-dir caching, set the top-level cacheDir to the desired location and use :cacheDir in the caches entries."],"exampleFix":"# before\n[caches.getresource]\ndir = \":cachedirr/getresource\"\n# after\n[caches.getresource]\ndir = \":cacheDir/getresource\"","handlingStrategy":"validation","validationCode":"if strings.HasPrefix(dir, \":\") {\n    first := strings.SplitN(dir, string(filepath.Separator), 2)[0]\n    if first != \":cacheDir\" && first != \":resourceDir\" {\n        return fmt.Errorf(\"invalid placeholder %q; use :cacheDir or :resourceDir\", first)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only :cacheDir and :resourceDir are valid placeholders — check spelling and casing","Don't invent placeholders like :tmpDir or :projectDir","Placeholders must be the leading path segment"],"tags":["hugo","filecache","config","placeholder","validation"],"analyzedSha":"8a468df065a75c1c7cf9f6850f32148746590ea5","analyzedAt":"2026-07-31T21:23:07.045Z","schemaVersion":2}