dianping/cat · error · StaticError
XQST0088
XQST0088
Error message
empty target namespace in module import or module declaration
What it means
XQST0088 is the standard XQuery error for an empty target namespace in a module import or module declaration. addNamespace() raises it whenever uri === '' — a module boundary (import or 'module namespace ...') must name a non-empty namespace URI, because module components are addressed by namespace.
Source
Thrown at cat-home/src/main/webapp/assets/js/editor/worker-xquery.js:1804
}
} catch(e) {
throw new StaticError('XQST0059', 'module "' + uri + '" not found', pos);
}
}
return this;
},
getAvailableModuleNamespaces: function(){
return this.root.availableModuleNamespaces;
},
getPrefixByNamespace: function(uri){
return this.root.namespaces[uri].prefix;
},
addNamespace: function (uri, prefix, pos, type) {
if(prefix === '' && type === 'module') {
throw new StaticWarning('W01', 'Avoid this type of import. Use import module namespace instead', pos);
}
if (uri === '') {
throw new StaticError('XQST0088', 'empty target namespace in module import or module declaration', pos);
}
var namespace = this.getNamespace(uri);
if (namespace && namespace.type === type && type !== 'declare' && !namespace.override) {
throw new StaticError('XQST0047', '"' + uri + '": duplicate target namespace', pos);
}
namespace = this.getNamespaceByPrefix(prefix);
if (namespace && !namespace.override) {
throw new StaticError('XQST0033', '"' + prefix + '": namespace prefix already bound to "' + namespace.uri + '"', pos);
}
namespace = this.namespaces[uri];
this.namespaces[uri] = {
prefix: prefix,
pos: pos,
type: type
};
if (namespace) {View on GitHub (pinned to e815e74d4c)
Solutions
- Fill in a real, absolute namespace URI in the import/declaration.
- If the query is generated, validate that the namespace variable is non-empty before emitting the import.
- Distinguish module imports from schema imports — only module boundaries require a target namespace here.
Example fix
// before module namespace ""; // after module namespace util = "http://example.org/xquery/util";
Defensive patterns
Strategy: validation
Validate before calling
// Ensure generated prologs never emit an empty target namespace
if (moduleUri === undefined || moduleUri === '') {
throw new Error('moduleUri required for module import: ' + moduleName);
} Type guard
function isNonEmptyNamespace(uri) {
return typeof uri === 'string' && uri.trim().length > 0;
} Try / catch
if (e.code === 'XQST0088') {
highlight(e.pos, 'Module import/declaration needs a non-empty namespace URI');
} Prevention
- For generated XQuery, unit-test that every emitted import has a non-empty URI.
- Treat empty template placeholders ('') as build errors before shipping queries.
When it happens
Trigger: addNamespace('', prefix, pos, type) — e.g. 'import module namespace p = "";' or 'module namespace "";' after prefix/QName expansion produced an empty URI.
Common situations: Copy-paste imports where the URI string was deleted; templates with placeholder quotes; queries built by string concatenation where the namespace variable is undefined/empty.
Related errors
AI-assisted analysis of dianping/cat@e815e74d4c (2026-08-14).
Data as JSON: /api/errors/ade693294de04d41.
Report an issue: GitHub.