quarkusio/quarkus · error · PSQLException
INVALID_PARAMETER_TYPE
INVALID_PARAMETER_TYPE
Error message
Unknown XML Source class: {0} What it means
PgSQLXML.getSource(sourceClass) only supports a fixed set of Source classes (DOMSource, SAXSource, StAXSource). If the requested class is not one of the supported implementations, it throws a PSQLException with SQLState INVALID_PARAMETER_TYPE and the parameterized message 'Unknown XML Source class: {0}'. This is a limitation of the substituted PgSQLXML implementation.
Source
Thrown at extensions/jdbc/jdbc-postgresql/runtime/src/main/java/io/quarkus/jdbc/postgresql/runtime/graal/PgSQLXML.java:193
DOMSource domSource = new DOMSource(builder.parse(input));
//noinspection unchecked
return (T) domSource;
} else if (SAXSource.class.equals(sourceClass)) {
XMLReader reader = getXmlFactoryFactory().createXMLReader();
InputSource is = new InputSource(new StringReader(data));
return sourceClass.cast(new SAXSource(reader, is));
} else if (StreamSource.class.equals(sourceClass)) {
return sourceClass.cast(new StreamSource(new StringReader(data)));
} else if (StAXSource.class.equals(sourceClass)) {
XMLInputFactory xif = getXmlFactoryFactory().newXMLInputFactory();
XMLStreamReader xsr = xif.createXMLStreamReader(new StringReader(data));
return sourceClass.cast(new StAXSource(xsr));
}
} catch (Exception e) {
throw new PSQLException(GT.tr("Unable to decode xml data."), PSQLState.DATA_ERROR, e);
}
throw new PSQLException(GT.tr("Unknown XML Source class: {0}", sourceClass),
PSQLState.INVALID_PARAMETER_TYPE);
}
@Substitute
@Override
public synchronized String getString() throws SQLException {
checkFreed();
ensureInitialized();
return data;
}
@Substitute
@Override
public synchronized OutputStream setBinaryStream() throws SQLException {
checkFreed();
initialize();
active = true;
byteArrayOutputStream = new ByteArrayOutputStream();View on GitHub (pinned to e1c734241f)
Solutions
- Request only javax.xml.transform.dom.DOMSource, javax.xml.transform.sax.SAXSource, or javax.xml.transform.stax.StAXSource.
- Use getString() and construct the desired Source from the returned string yourself.
- For JAXB, marshal via DOMSource: sqlxml.getSource(DOMSource.class) then unmarshal from the DOM node.
- Consider contributing support for the missing Source type to the extension's substitution class.
Example fix
// before JAXBSource s = sqlxml.getSource(JAXBSource.class); // throws INVALID_PARAMETER_TYPE // after DOMSource ds = sqlxml.getSource(DOMSource.class); MyType v = jc.createUnmarshaller().unmarshal(ds.getNode(), MyType.class).getValue();
Defensive patterns
Strategy: type-guard
Validate before calling
static boolean isSupportedSource(Class<?> c) {
return c == DOMSource.class || c == SAXSource.class || c == StAXSource.class;
} Type guard
static boolean supportedXmlSource(Class<? extends Source> c) {
return javax.xml.transform.dom.DOMSource.class.equals(c)
|| javax.xml.transform.sax.SAXSource.class.equals(c)
|| javax.xml.transform.stax.StAXSource.class.equals(c);
} Try / catch
try {
Source s = sqlxml.getSource(requestedClass);
} catch (PSQLException e) {
if ("INVALID_PARAMETER_TYPE".equals(e.getSQLState()) && e.getMessage().startsWith("Unknown XML Source class")) {
String xml = sqlxml.getString();
s = buildSourceManually(xml, requestedClass);
} else { throw e; }
} Prevention
- Only request DOMSource, SAXSource, or StAXSource from PgSQLXML
- Wrap custom Source needs around getString() output
- Centralize SQLXML access in a helper that enforces the supported Source types
When it happens
Trigger: Calling sqlxml.getSource(SomeCustomSource.class) or a Source subclass not in the substitution's if/else chain (e.g. a custom AbstractTransformer-based Source), so no branch matches and the fall-through throw executes.
Common situations: Code ported from other JDBC drivers accepting arbitrary Source types; use of library-specific Source implementations (e.g. JAXBSource) that the substituted class does not handle.
Related errors
- DATA_ERROR
- DATA_ERROR
- The org.postgresql.sspi.SSPIClient is not available on Graal
- UNEXPECTED_ERROR
- OBJECT_NOT_IN_STATE
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/e538953e9acefb3c.
Report an issue: GitHub.