{"record":{"id":"b1047bb5c8f5cebf","repo":"gohugoio/hugo","slug":"postcss-config-q-not-found","errorCode":null,"errorMessage":"postcss config %q not found","messagePattern":"postcss config %q not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"resources/resource_transformers/cssjs/postcss.go","lineNumber":179,"sourceCode":"\tif options.Config != \"\" {\n\t\tconfigFile = options.Config\n\t} else {\n\t\tfor _, name := range []string{\"postcss.config.js\", \"postcss.config.mjs\", \"postcss.config.cjs\"} {\n\t\t\tconfigFile = t.rs.BaseFs.ResolveJSConfigFile(name)\n\t\t\tif configFile != \"\" {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tif configFile != \"\" {\n\t\tconfigFile = filepath.Clean(configFile)\n\t\t// We need an absolute filename to the config file.\n\t\tif !filepath.IsAbs(configFile) {\n\t\t\tconfigFile = t.rs.BaseFs.ResolveJSConfigFile(configFile)\n\t\t\tif configFile == \"\" && options.Config != \"\" {\n\t\t\t\t// Only fail if the user specified config file is not found.\n\t\t\t\treturn fmt.Errorf(\"postcss config %q not found\", options.Config)\n\t\t\t}\n\t\t}\n\t}\n\n\tvar cmdArgs []any\n\n\tif configFile != \"\" {\n\t\tinfol.Logf(\"use config file %q\", configFile)\n\t\tcmdArgs = []any{\"--config\", configFile}\n\t}\n\n\tif optArgs := options.toArgs(); len(optArgs) > 0 {\n\t\tcmdArgs = append(cmdArgs, collections.StringSliceToInterfaceSlice(optArgs)...)\n\t}\n\n\tvar errBuf bytes.Buffer\n\n\tstderr := io.MultiWriter(infow, &errBuf)","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/resources/resource_transformers/cssjs/postcss.go#L161-L197","documentation":"Thrown by the PostCSS transformer when options.Config is explicitly set by the user but the named config file cannot be resolved by BaseFs.ResolveJSConfigFile. Auto-discovered configs (postcss.config.js/mjs/cjs) never trigger this; it fires only for a missing user-specified config path.","triggerScenarios":"Calling css.PostCSS with options map containing \"config\": \"./postcss/prod.js\" where that path is not resolvable relative to the project working dir / JS config filesystem.","commonSituations":"Moving/deleting a custom postcss config without updating the template option; using a path that exists only in a different module or theme; case mismatch on case-sensitive filesystems.","solutions":["Confirm the file at the path given by options[\"config\"] exists; the error echoes the exact unresolved path.","Use an absolute path or place postcss.config.js at the project root and remove the 'config' option to rely on auto-discovery.","If you use Tailwind, ensure the postcss config actually loads @tailwindcss/postcss or tailwindcss plugin as intended."],"exampleFix":"// before\n{{ $css := resources.Get \"css/main.css\" | css.PostCSS (dict \"config\" \"postcss/prod.config.js\") }}\n\n// after\n{{ $css := resources.Get \"css/main.css\" | css.PostCSS }} // uses ./postcss.config.js","handlingStrategy":"validation","validationCode":"if cfg, ok := opts[\"config\"]; ok {\n    p := filepath.Clean(fmt.Sprint(cfg))\n    if _, err := os.Stat(p); err != nil {\n        return fmt.Errorf(\"postcss config %q not found\", p)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer auto-discovered postcss.config.js over an explicit 'config'.","Commit postcss.config.js to the repo root and reference it relatively.","Verify config paths on case-sensitive filesystems."],"tags":["postcss","configuration","config-not-found","asset-pipeline"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}