{"record":{"id":"3c6ec058c0073716","repo":"json-path/JsonPath","slug":"string-literal-does-not-have-matching-quotes-expe","errorCode":null,"errorMessage":"String literal does not have matching quotes. Expected ","messagePattern":"String literal does not have matching quotes\\. Expected ","errorType":"exception","errorClass":"InvalidPathException","httpStatus":null,"severity":"error","filePath":"json-path/src/main/java/com/jayway/jsonpath/internal/filter/FilterCompiler.java","lineNumber":316,"sourceCode":"                int endFlagsIndex = endOfFlags(closingIndex + 1);\n                if (endFlagsIndex > closingIndex) {\n                    CharSequence flags = filter.subSequence(closingIndex + 1, endFlagsIndex);\n                    closingIndex += flags.length();\n                }\n            }\n            filter.setPosition(closingIndex + 1);\n        }\n        CharSequence pattern = filter.subSequence(begin, filter.position());\n        logger.trace(\"PatternNode from {} to {} -> [{}]\", begin, filter.position(), pattern);\n        return ValueNode.createPatternNode(pattern);\n    }\n\n    private StringNode readStringLiteral(char endChar) {\n        int begin = filter.position();\n\n        int closingSingleQuoteIndex = filter.nextIndexOfUnescaped(endChar);\n        if (closingSingleQuoteIndex == -1) {\n            throw new InvalidPathException(\"String literal does not have matching quotes. Expected \" + endChar + \" in \" + filter);\n        } else {\n            filter.setPosition(closingSingleQuoteIndex + 1);\n        }\n        CharSequence stringLiteral = filter.subSequence(begin, filter.position());\n        logger.trace(\"StringLiteral from {} to {} -> [{}]\", begin, filter.position(), stringLiteral);\n        return ValueNode.createStringNode(stringLiteral, true);\n    }\n\n    private NumberNode readNumberLiteral() {\n        int begin = filter.position();\n\n        while (filter.inBounds() && filter.isNumberCharacter(filter.position())) {\n            filter.incrementPosition(1);\n        }\n        CharSequence numberLiteral = filter.subSequence(begin, filter.position());\n        logger.trace(\"NumberLiteral from {} to {} -> [{}]\", begin, filter.position(), numberLiteral);\n        return ValueNode.createNumberNode(numberLiteral);\n    }","sourceCodeStart":298,"sourceCodeEnd":334,"githubUrl":"https://github.com/json-path/JsonPath/blob/62a4c9f0f65ba3f625aa0867d64c528ba72d09ec/json-path/src/main/java/com/jayway/jsonpath/internal/filter/FilterCompiler.java#L298-L334","documentation":"Raised in FilterCompiler.readStringLiteral when a quoted literal in a filter expression is opened but the matching closing quote is never found (or is escaped), so the scanner consumes to the end of the path. It signals malformed filter syntax, not a data problem; the at-fault input is a path like $.items[?(@.name == 'abc] with an unterminated string.","triggerScenarios":"Thrown at json-path/src/main/java/com/jayway/jsonpath/internal/filter/FilterCompiler.java:316 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add the missing closing quote so the literal is balanced, e.g. $.items[?(@.name == 'abc')]","If the string itself contains quotes, use the other quote character or the language's escaping convention supported by the parser","Check for accidental stray quotes earlier in the filter that flipped open/close state","Sanitize/validate user-supplied filter expressions before handing them to JsonPath.compile or JsonPath.parse"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"62a4c9f0f65ba3f625aa0867d64c528ba72d09ec","analyzedAt":"2026-09-11T11:36:00.448Z","contentChangedAt":"2026-09-11T11:36:00.448Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}