{"record":{"id":"c9398d86b8a7f150","repo":"apache/shardingsphere","slug":"unsupported-type-s","errorCode":null,"errorMessage":"Unsupported type: %s","messagePattern":"Unsupported type: (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"infra/rewrite/core/src/main/java/org/apache/shardingsphere/infra/rewrite/sql/token/common/pojo/generic/InsertValue.java","lineNumber":101,"sourceCode":"    \n    private void getAddedItems(final int index, final StringJoiner joiner) {\n        Collection<Object> currentAddedItems = orderedAddedItems.get(index);\n        if (null == currentAddedItems) {\n            return;\n        }\n        for (Object each : currentAddedItems) {\n            joiner.add(getItemValue(each));\n        }\n    }\n    \n    private String getItemValue(final Object value) {\n        if (value instanceof ExpressionSegment) {\n            return doGetValue((ExpressionSegment) value);\n        }\n        if (value instanceof SQLToken) {\n            return value.toString();\n        }\n        throw new IllegalStateException(\"Unsupported type: \" + value.getClass().getName());\n    }\n    \n    /**\n     * Get value.\n     *\n     * @param index index\n     * @return value\n     */\n    public String getValue(final int index) {\n        SQLToken substitutedSQLToken = substitutedSQLTokens.get(index);\n        return null == substitutedSQLToken ? doGetValue(values.get(index)) : substitutedSQLToken.toString();\n    }\n    \n    private String doGetValue(final ExpressionSegment expressionSegment) {\n        if (expressionSegment instanceof ParameterMarkerExpressionSegment) {\n            ParameterMarkerExpressionSegment segment = (ParameterMarkerExpressionSegment) expressionSegment;\n            return ParameterMarkerType.QUESTION == segment.getParameterMarkerType() ? \"?\" : \"$\" + (segment.getParameterMarkerIndex() + 1);\n        }","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/infra/rewrite/core/src/main/java/org/apache/shardingsphere/infra/rewrite/sql/token/common/pojo/generic/InsertValue.java#L83-L119","documentation":"InsertValue.getItemValue is an internal rewrite-engine invariant: every item inside a rewritten INSERT values tuple must be either an ExpressionSegment (parsed SQL expression) or a SQLToken (rewritten token). If an object of any other class ends up in the value items, the rewriter throws IllegalStateException naming the offending class. This is not a user-configuration error — it indicates a parser/rewriter mismatch or an unsupported INSERT form inside ShardingSphere itself.","triggerScenarios":"Executing INSERT statements with unusual value forms (special parameter markers, dialect-specific defaults, function expressions, multi-value inserts) that make a dialect parser or extension put a non-segment, non-token object into the values list; custom code constructing InsertValue with arbitrary objects.","commonSituations":"Upgrading ShardingSphere to a version whose parser produces new segment types the rewriter does not recognize; using a less common dialect's INSERT syntax; plugins/extensions that inject custom value objects during rewriting.","solutions":["Upgrade (or pin) ShardingSphere to a version where parser and rewriter are aligned — check the release notes/GitHub issues for the offending class name in the message.","Simplify the INSERT to the plain VALUES (...) form and add exotic expressions via separate statements.","If it comes from your own extension code feeding InsertValue, ensure every item you add is an ExpressionSegment or SQLToken."],"exampleFix":"// before\nINSERT INTO t_order (id, remark) VALUES (NEXTVAL('seq'), DEFAULT); // dialect-specific DEFAULT trips the rewriter\n\n// after\nINSERT INTO t_order (id, remark) VALUES (?, ?); // supply DEFAULT/sequence semantics via parameters or plain values","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { rewriteContext.insertValue(...) } catch (IllegalStateException e) { /* parser/rewriter mismatch: capture SQL + version, report upstream */ }","preventionTips":["Pin a ShardingSphere version where your INSERT forms are covered; upgrade parser and rewriter together.","Keep INSERT VALUES in plain literal/parameter form; move exotic expressions out of the rewrite path."],"tags":["rewrite","insert","internal-invariant","parser"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}