pentaho/pentaho-kettle · error · KettleException
ERROR: There was an error opening the file, since the…
Error message
ERROR: There was an error opening the file, since the default namespace "
What it means
XMLOutput.openNewFile validates the user-configured default namespace with isValidNamespace before writing it via writeDefaultNamespace. If the namespace string is not a valid namespace declaration (must contain a URI, e.g. 'prefix=uri' or a valid URI), this KettleException is thrown while opening the output file.
Solutions
- Enter the namespace as 'prefix=uri' or a plain URI per the dialog's expected format, not 'xmlns=...' syntax
- Remove surrounding quotes or whitespace from the namespace value
- Validate the namespace string in a browser/XML tool before configuring
- Leave the namespace field empty if a default namespace is not required
Example fix
// before Namespace: xmlns="http://www.example.com/ns" // after Namespace: http://www.example.com/ns
Defensive patterns
Strategy: validation
Validate before calling
String ns = meta.getNameSpace();
if (ns != null && !ns.isEmpty() && !(ns.matches("[^=]+=[^\s]+") || ns.matches("https?://\S+"))) throw new IllegalArgumentException("Invalid namespace: " + ns); Type guard
boolean nsLooksValid = ns == null || ns.isEmpty() || ns.contains("=") || ns.startsWith("http"); Try / catch
try { openNewFile(); } catch (KettleException e) { log.error("Namespace rejected: check the Namespace field format", e); } Prevention
- Enter plain URI or prefix=uri, never xmlns=... syntax
- Trim whitespace/quotes pasted into the namespace field
- Validate namespace in an XML editor before configuring
- Leave namespace empty when not required
When it happens
Trigger: processRow or init -> openNewFile when meta.getNameSpace() is non-empty and fails isValidNamespace, e.g. 'xmlns=http://x' instead of 'http://x', empty URI, or illegal characters.
Common situations: Users paste a full xmlns attribute syntax into the Namespace field instead of just the URI; typos like missing URI after '='; copy-paste from XML documents including quotes.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- JobXMLWellFormed.Error.Exception.UnableLoadXML
- AddSequenceMeta.Exception.ErrorLoadingStepInfo
- AggregateRowsMeta.Exception.UnableToLoadStepInfo
- AnalyticQueryMeta.Exception.UnableToLoadStepInfoFromXML
- AppendMeta.Exception.UnableToLoadStepInfo
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/a13bd4deda0e50fd.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xmloutput/XMLOutput.java:345
data.writer = XML_OUT_FACTORY.createXMLStreamWriter( outputStream, meta.getEncoding() );
data.writer.writeStartDocument( meta.getEncoding(), "1.0" );
} else {
logBasic( "Opening output stream in default encoding : " + Const.XML_ENCODING );
data.writer = XML_OUT_FACTORY.createXMLStreamWriter( outputStream );
data.writer.writeStartDocument( Const.XML_ENCODING, "1.0" );
}
data.writer.writeCharacters( EOL );
}
// OK, write the header & the parent element:
data.writer.writeStartElement( meta.getMainElement() );
// Add the name space if defined
String namespace = meta.getNameSpace();
if ( !Utils.isEmpty( namespace ) ) {
if ( isValidNamespace( namespace ) ) {
data.writer.writeDefaultNamespace( namespace );
} else {
throw new KettleException( "ERROR: There was an error opening the file, since the default namespace \""
+ namespace + "\" is invalid." );
}
}
data.writer.writeCharacters( EOL );
retval = true;
} catch ( KettleException e ) {
logError( e.toString() );
} catch ( Exception e ) {
logError( "Error opening new file : " + e.toString() );
}
data.splitnr++;
return retval;
}
/**View on GitHub (pinned to f3058517a1)