{"record":{"id":"59040b890e2ef32e","repo":"gohugoio/hugo","slug":"unknown-component-q","errorCode":null,"errorMessage":"unknown component: %q","messagePattern":"unknown component: %q","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hugolib/hugo_sites_build.go","lineNumber":1086,"sourceCode":"\t\tcase files.ComponentFolderData:\n\t\t\tlogger.Println(\"Data changed\", pathInfo.Path())\n\n\t\t\t// This should cover all usage of hugo.Data.\n\t\t\t// Currently very coarse grained.\n\t\t\tchanges = append(changes, siteidentities.Data)\n\t\t\th.init.data.Reset()\n\t\tcase files.ComponentFolderI18n:\n\t\t\tlogger.Println(\"i18n changed\", pathInfo.Path())\n\t\t\ti18nChanged = true\n\t\t\t// It's hard to determine the exact change set of this,\n\t\t\t// so be very coarse grained for now.\n\t\t\tchanges = append(changes, identity.GenghisKhan)\n\t\tcase files.ComponentFolderArchetypes:\n\t\t\t// Ignore for now.\n\t\tcase files.ComponentFolderStatic:\n\t\t\t// Handled by the static file syncer.\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"unknown component: %q\", pathInfo.Component()))\n\t\t}\n\t}\n\n\tchangedPaths.deleted = removeDuplicatePaths(changedPaths.deleted)\n\tchangedPaths.addedFiles = removeDuplicatePaths(changedPaths.addedFiles)\n\tchangedPaths.changedFiles = removeDuplicatePaths(changedPaths.changedFiles)\n\n\th.Log.Trace(logg.StringFunc(func() string {\n\t\tvar sb strings.Builder\n\t\tsb.WriteString(\"Resolved paths:\\n\")\n\t\tsb.WriteString(\"Deleted:\\n\")\n\t\tfor _, p := range changedPaths.deleted {\n\t\t\tsb.WriteString(\"path: \" + p.Path())\n\t\t\tsb.WriteString(\"\\n\")\n\t\t}\n\t\tsb.WriteString(\"Added:\\n\")\n\t\tfor _, p := range changedPaths.addedFiles {\n\t\t\tsb.WriteString(\"path: \" + p.Path())","sourceCodeStart":1068,"sourceCodeEnd":1104,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/hugolib/hugo_sites_build.go#L1068-L1104","documentation":"Panic in the change-resolution logic: a changed path's Component() returns a value not handled by the switch over known component folders (content, layouts, assets, i18n, archetypes, static, etc.). The default branch panics, signalling that Hugo encountered a component folder it does not know how to treat during incremental rebuilds.","triggerScenarios":"Triggered during an incremental/watch build when a file change is classified into a component folder not present in the switch. Adding a new top-level project folder that Hugo misclassifies, or a pathInfo whose Component() yields an unexpected string. Typically an internal gap when new component types are introduced.","commonSituations":"Watching a project with a custom/unusual directory layout. Hugo version mismatch where a newer feature writes a component type an older core cannot classify. Editing files under a non-standard folder during live reload.","solutions":["Clean-rebuild instead of relying on the incremental watch (hugo --gc or fresh server start).","Ensure files that trigger rebuilds live under standard Hugo component folders (content, layouts, assets, static, data, i18n, archetypes).","Upgrade Hugo to match the feature set producing the component type; if it reproduces, report with the folder path."],"exampleFix":"# before: a changed file under a non-component top-level folder\n/myproject/customdir/foo.html  # panics on change\n\n# after: move watched content under a recognized component folder\n/myproject/layouts/_default/foo.html","handlingStrategy":"validation","validationCode":"// Keep changed files under recognized component folders (content, layouts, assets, static, data, i18n, archetypes).\n// For a clean rebuild, remove the incremental/watch state.","typeGuard":null,"tryCatchPattern":"// Wrap Build in recover() to convert the panic to an error during watch (see 781).","preventionTips":["Run a clean build when watch panics on a non-component folder.","Avoid editing files under custom top-level folders during live reload.","Match Hugo version to the features you use.","Report reproducer to Hugo if files are under standard folders."],"tags":["incremental","watch","components","panic","internal-invariant"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}