{"record":{"id":"6aab01a583976ece","repo":"apache/beam","slug":"invalid-namespace-provide-a-different-one-q-contains-the","errorCode":null,"errorMessage":"invalid namespace, provide a different one: %q contains the separator %q","messagePattern":"invalid namespace, provide a different one: %q contains the separator %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/xlangx/registry.go","lineNumber":184,"sourceCode":"}\n\n// RegisterHandler associates a namespace, with a handler.\n//\n// Namespaces may not have the configuration separator \":\" in them,\n// nor may they be a restricted namespace, like \"localhost\" or \"http\".\nfunc (r *registry) RegisterHandler(namespace string, handler HandlerFunc) error {\n\tif err := validateNamespace(namespace); err != nil {\n\t\treturn fmt.Errorf(\"xlangx.RegisterHandler: %v\", err)\n\t}\n\tr.mu.Lock()\n\tdefer r.mu.Unlock()\n\tr.handlers[namespace] = handler\n\treturn nil\n}\n\nfunc validateNamespace(namespace string) error {\n\tif strings.Contains(namespace, Separator) {\n\t\treturn fmt.Errorf(\"invalid namespace, provide a different one: %q contains the separator %q\", namespace, Separator)\n\t}\n\tif _, ok := restricted[namespace]; ok {\n\t\treturn fmt.Errorf(\"invalide namespace, provide a different one: %q is a restricted namespace\", namespace)\n\t}\n\treturn nil\n}\n\n// RegisterOverrideForUrn instructs using expansionAddr for CrossLanguage\n// transforms with urn. expansionAddr should either be registered with an\n// Expansion handler, or an Expansion service address.\nfunc (r *registry) RegisterOverrideForUrn(urn, expansionAddr string) error {\n\tr.mu.Lock()\n\tdefer r.mu.Unlock()\n\tif err := r.validateAddr(expansionAddr); err != nil {\n\t\treturn fmt.Errorf(\"xlangx.RegisterExpansionForUrn(%q,%q) error: %v\", urn, expansionAddr, err)\n\t}\n\tr.urnOverrides[urn] = expansionAddr\n\treturn nil","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/xlangx/registry.go#L166-L202","documentation":"validateNamespace rejects namespaces containing the Separator ':' because it would corrupt the scheme-qualified expansion address parsing. The error names the offending namespace and the separator character so the caller can pick another name.","triggerScenarios":"Registering a handler whose namespace string contains \":\" — e.g. \"http://x\", \"my:ns\", or any URL-like value passed whole as the namespace.","commonSituations":"Passing a full expansion service URL as the namespace; concatenating scheme and name with a colon; copying an example URN (\"namespace:urn\") into the namespace parameter by mistake.","solutions":["Strip the scheme and any colons; pass only the bare namespace token.","Use dashes or slashes-free identifiers instead of colons in generated namespace names.","Pre-validate with strings.Contains(ns, \":\") in caller code for clearer user errors."],"exampleFix":"// before\nxlangx.RegisterHandler(\"acme:v1\", h)\n// after\nxlangx.RegisterHandler(\"acme-v1\", h)","handlingStrategy":"validation","validationCode":"if strings.Contains(namespace, \":\") {\n    return fmt.Errorf(\"namespace %q must not contain ':'\", namespace)\n}","typeGuard":null,"tryCatchPattern":"if err := xlangx.RegisterHandler(ns, h); err != nil {\n    return fmt.Errorf(\"invalid expansion namespace %q: %w\", ns, err)\n}","preventionTips":["Validate namespaces against ^[A-Za-z0-9._-]+$ before registration","Never pass full URLs as namespaces","Document the no-colon rule for config authors"],"tags":["go","validation","namespace"],"backgroundTag":"invalid-identifier-format","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}