{"record":{"id":"fb1ba500edbee3b0","repo":"gohugoio/hugo","slug":"id-must-not-contain-forward-slashes","errorCode":null,"errorMessage":"id must not contain forward slashes","messagePattern":"id must not contain forward slashes","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/esbuild/batch.go","lineNumber":163,"sourceCode":"\to.compiledPrev = o.compiled\n\to.compiled, o.compileErr = o.compiled.compileOptions(m, o.defaults)\n\to.checkCompileErr()\n\treturn \"\"\n}\n\n// ValidateBatchID validates the given ID according to some very\nfunc ValidateBatchID(id string, isTopLevel bool) error {\n\tif id == \"\" {\n\t\treturn fmt.Errorf(\"id must be set\")\n\t}\n\t// No Windows slashes.\n\tif strings.Contains(id, \"\\\\\") {\n\t\treturn fmt.Errorf(\"id must not contain backslashes\")\n\t}\n\n\t// Allow forward slashes in top level IDs only.\n\tif !isTopLevel && strings.Contains(id, \"/\") {\n\t\treturn fmt.Errorf(\"id must not contain forward slashes\")\n\t}\n\n\treturn nil\n}\n\nfunc newIsBuiltOrTouched() isBuiltOrTouched {\n\treturn isBuiltOrTouched{\n\t\tbuilt:   make(buildIDs),\n\t\ttouched: make(buildIDs),\n\t}\n}\n\nfunc newOpts[K any, C optionsCompiler[C]](key K, optionsID string, defaults defaultOptionValues) *opts[K, C] {\n\treturn &opts[K, C]{\n\t\tkey: key,\n\t\th: &optsHolder[C]{\n\t\t\toptionsID:        optionsID,\n\t\t\tdefaults:         defaults,","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/internal/js/esbuild/batch.go#L145-L181","documentation":"ValidateBatchID forbids forward slashes in a non-top-level batch id (batch.go:161-164). Only top-level ids may contain '/'; sub-group ids (isTopLevel==false, as used by BatchGroup) must be a single path segment. This prevents sub-ids from escaping their group's namespace.","triggerScenarios":"Calling Batcher.Group(ctx, \"sub/path\") — Group passes isTopLevel=false, so any '/' in the id triggers the error (and a panic, since Group panics on validation failure).","commonSituations":"Using a derived path with slashes as a sub-group id instead of a flat name; treating Group like a top-level entry point.","solutions":["Use a single-segment id (no '/') for sub-groups; encode hierarchy via the group structure, not the id string.","If you need a path-like id, use it at the top level (isTopLevel=true) or flatten it (replace '/' with '_').","Validate the id with ValidateBatchID(id, false) before calling Group to get a returned error instead of a panic."],"exampleFix":"// before\ngroup := batcher.Group(ctx, \"my/sub/group\") // panics\n\n// after\ngroup := batcher.Group(ctx, \"my_sub_group\")","handlingStrategy":"validation","validationCode":"func validateGroupID(id string) error {\n    // Sub-group ids must be a single segment.\n    return esbuild.ValidateBatchID(id, false)\n}","typeGuard":"func isSingleSegmentID(id string) bool { return !strings.Contains(id, \"/\") }","tryCatchPattern":null,"preventionTips":["Use flat names for sub-group ids; encode hierarchy with separators like '_'.","Call ValidateBatchID(id, false) before Group to get an error instead of a panic.","Reserve '/' for top-level ids only."],"tags":["esbuild","batch","js","validation","paths"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}