{"record":{"id":"c73070bd2cd1ce14","repo":"dianping/cat","slug":"xqst0033","errorCode":"XQST0033","errorMessage":"\"{prefix}\": namespace prefix already bound to \"{uri}\"","messagePattern":"\"(.+?)\": namespace prefix already bound to \"(.+?)\"","errorType":"error_code","errorClass":"StaticError","httpStatus":null,"severity":"error","filePath":"cat-home/src/main/webapp/assets/js/editor/worker-xquery.js","lineNumber":1812,"sourceCode":"            return this.root.availableModuleNamespaces;\n        },\n        getPrefixByNamespace: function(uri){\n            return this.root.namespaces[uri].prefix;\n        },\n        addNamespace: function (uri, prefix, pos, type) {\n            if(prefix === '' && type === 'module') {\n                throw new StaticWarning('W01', 'Avoid this type of import. Use import module namespace instead', pos);\n            }\n            if (uri === '') {\n                throw new StaticError('XQST0088', 'empty target namespace in module import or module declaration', pos);\n            }\n            var namespace = this.getNamespace(uri);\n            if (namespace && namespace.type === type && type !== 'declare' && !namespace.override) {\n                throw new StaticError('XQST0047', '\"' + uri + '\": duplicate target namespace', pos);\n            }\n            namespace = this.getNamespaceByPrefix(prefix);\n            if (namespace && !namespace.override) {\n                throw new StaticError('XQST0033', '\"' + prefix + '\": namespace prefix already bound to \"' + namespace.uri + '\"', pos);\n            }\n\n            namespace = this.namespaces[uri];\n            this.namespaces[uri] = {\n                prefix: prefix,\n                pos: pos,\n                type: type\n            };\n\n            if (namespace) {\n                throw new StaticWarning('W02', '\"' + uri + '\" already bound to the \"' + namespace.prefix + '\" prefix', pos);\n            }\n\n        },\n\n        getNamespaces: function(){\n            return this.root.namespaces;\n        },","sourceCodeStart":1794,"sourceCodeEnd":1830,"githubUrl":"https://github.com/dianping/cat/blob/e815e74d4c2dd74edac831241f1253fcc7d25381/cat-home/src/main/webapp/assets/js/editor/worker-xquery.js#L1794-L1830","documentation":"XQST0033 is the standard XQuery error for a namespace prefix already bound to a different URI. addNamespace() resolves the requested prefix via getPrefixByPrefix lookup; if a prior binding exists and is not marked override, the new binding is rejected because re-binding a prefix to a different namespace within overlapping scope is illegal (predeclared prefixes like xml/xmlns can never be rebound).","triggerScenarios":"'declare namespace foo = \"U1\";' followed later by 'import module namespace foo = \"U2\";', or two declare namespace statements using the same prefix with different URIs in the same scope chain.","commonSituations":"Concatenating query prologs from multiple sources; a module's internal prefix colliding with the main query's prefix; renaming refactors that leave stale declarations.","solutions":["Pick a different prefix for the new namespace binding.","Or remove/merge the earlier declaration that already claimed the prefix.","Avoid reusing well-known prefixes (fn, local, xml, xs) for your own namespaces."],"exampleFix":"// before\ndeclare namespace foo = \"http://a.com\";\nimport module namespace foo = \"http://b.com\";\n\n// after\ndeclare namespace foo = \"http://a.com\";\nimport module namespace bmod = \"http://b.com\";","handlingStrategy":"validation","validationCode":"// Check prefix uniqueness across declarations/imports before analysis\nvar byPrefix = {};\nbindings.forEach(function(b) {\n  if (byPrefix[b.prefix] && byPrefix[b.prefix] !== b.uri) {\n    warn('Prefix ' + b.prefix + ' rebound from ' + byPrefix[b.prefix] + ' to ' + b.uri);\n  }\n  byPrefix[b.prefix] = b.uri;\n});","typeGuard":null,"tryCatchPattern":"if (e.code === 'XQST0033') {\n  highlight(e.pos, 'Pick a different prefix or remove the earlier binding');\n}","preventionTips":["Use one prefix per namespace across the whole project (project-level prefix convention).","Never rebind reserved prefixes (xml, xmlns, fn, xs, local).","When merging files, dedupe the combined prolog before saving."],"tags":["xquery","namespace","prefix-conflict"],"backgroundTag":null,"analyzedSha":"e815e74d4c2dd74edac831241f1253fcc7d25381","analyzedAt":"2026-08-14T14:22:34.512Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}