{"record":{"id":"4ea3ac761f95bc3c","repo":"JetBrains/intellij-community","slug":"error-package-set-position-parsing-error","errorCode":"error.package.set.position.parsing.error","errorMessage":"{0} at position {1}","messagePattern":"(.+?) at position (.+?)","errorType":"exception","errorClass":"ParsingException","httpStatus":null,"severity":"warning","filePath":"java/java-impl/src/com/intellij/psi/search/scope/packageSet/PatternPackageSetParserExtension.java","lineNumber":90,"sourceCode":"      lexer.advance();\n    }\n\n    if (pattern.isEmpty()) {\n      error(CodeInsightBundle.message(\"error.package.set.pattern.expectations\"), lexer);\n    }\n\n    return pattern.toString();\n  }\n\n\n  private static String getTokenText(Lexer lexer) {\n    int start = lexer.getTokenStart();\n    int end = lexer.getTokenEnd();\n    return lexer.getBufferSequence().subSequence(start, end).toString();\n  }\n\n  private static void error(String message, Lexer lexer) throws ParsingException {\n    throw new ParsingException(\n      CodeInsightBundle.message(\"error.package.set.position.parsing.error\", message, (lexer.getTokenStart() + 1)));\n  }\n}\n","sourceCodeStart":72,"sourceCodeEnd":94,"githubUrl":"https://github.com/JetBrains/intellij-community/blob/be881553f2a76ac8b4ea53950d93f0de78295c19/java/java-impl/src/com/intellij/psi/search/scope/packageSet/PatternPackageSetParserExtension.java#L72-L94","documentation":"Thrown by PatternPackageSetParserExtension.error() while parsing a custom file scope/package-set pattern (Settings > Scopes or custom scope patterns). The message wraps an underlying parser message plus a 1-based buffer position, producing a ParsingException displayed when the scope pattern is invalid. It is the generic syntax-error exit for the pattern DSL.","triggerScenarios":"Typing a malformed scope pattern such as 'src:*java{ (unbalanced brace)', 'file:src//*' with illegal operators, unexpected token after a pattern, or unterminated quoted strings; anything that makes the lexer hit an unexpected token mid-pattern.","commonSituations":"Hand-writing custom scope patterns in Project > Appearance & Behavior > Scopes; copying patterns from docs with smart quotes or truncated characters; patterns that worked in older IDE versions but use syntax no longer accepted.","solutions":["Read the reported position (1-based) and fix the token at that offset in the pattern, e.g. balance braces and parentheses.","Use the IDE's scope editor preview to iterate: it highlights which files match as you fix the pattern.","Start from a known-good pattern ('file:src//*.{java,kt}') and add constraints incrementally.","Verify syntax against the documented pattern language (file:, src:, lib:, ! negation, && and || operators)."],"exampleFix":"// before (scope pattern)\nsrc:*java{\n// after\nsrc:*.{java}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { NamedScope scope = parsePattern(patternText); } catch (ParsingException e) { /* e.getMessage() includes 1-based position; highlight that offset in the editor */ }","preventionTips":["Use the scope editor's live preview to validate patterns while typing.","Build complex patterns incrementally from a known-good base pattern.","Avoid smart quotes and non-ASCII characters copied from web pages in scope patterns."],"tags":["java","scopes","pattern-parsing","intellij-platform"],"backgroundTag":null,"analyzedSha":"be881553f2a76ac8b4ea53950d93f0de78295c19","analyzedAt":"2026-08-14T14:13:06.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}