JetBrains/intellij-community · warning · ParsingException
error.package.set.position.parsing.error
error.package.set.position.parsing.error
Error message
{0} at position {1} What it means
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.
Source
Thrown at java/java-impl/src/com/intellij/psi/search/scope/packageSet/PatternPackageSetParserExtension.java:90
lexer.advance();
}
if (pattern.isEmpty()) {
error(CodeInsightBundle.message("error.package.set.pattern.expectations"), lexer);
}
return pattern.toString();
}
private static String getTokenText(Lexer lexer) {
int start = lexer.getTokenStart();
int end = lexer.getTokenEnd();
return lexer.getBufferSequence().subSequence(start, end).toString();
}
private static void error(String message, Lexer lexer) throws ParsingException {
throw new ParsingException(
CodeInsightBundle.message("error.package.set.position.parsing.error", message, (lexer.getTokenStart() + 1)));
}
}
View on GitHub (pinned to be881553f2)
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).
Example fix
// before (scope pattern)
src:*java{
// after
src:*.{java} Defensive patterns
Strategy: try-catch
Try / catch
try { NamedScope scope = parsePattern(patternText); } catch (ParsingException e) { /* e.getMessage() includes 1-based position; highlight that offset in the editor */ } Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Cannot create {0} - incorrect {1} template.
- Cannot create class-file
- Cannot bind to {element}
- No JDK specified
- Home directory is not specified for JDK
AI-assisted analysis of JetBrains/intellij-community@be881553f2 (2026-08-14).
Data as JSON: /api/errors/4ea3ac761f95bc3c.
Report an issue: GitHub.