{"record":{"id":"055507ff969898ca","repo":"JetBrains/intellij-community","slug":"mutation-signature-problem-invalid-token","errorCode":"mutation.signature.problem.invalid.token","errorMessage":"Invalid token: {0}; supported are 'this', 'io', 'param1', 'param2', and so on.","messagePattern":"Invalid token: (.+?); supported are 'this', 'io', 'param1', 'param2', and so on\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/MutationSignature.java","lineNumber":242,"sourceCode":"    for (String part : signature.split(\",\")) {\n      part = part.trim();\n      if (part.equals(\"this\")) {\n        mutatesThis = true;\n      }\n      else if (part.equals(\"io\")) {\n        mutatesIO = true;\n      }\n      else if (part.equals(\"param\")) {\n        if (args.length == 0) {\n          args = new boolean[] {true};\n        } else {\n          args[0] = true;\n        }\n      }\n      else if (part.startsWith(\"param\")) {\n        int argNum = Integer.parseInt(part.substring(\"param\".length()));\n        if (argNum < 0 || argNum > 255) {\n          throw new IllegalArgumentException(JavaAnalysisBundle.message(\"mutation.signature.problem.invalid.token\", part));\n        }\n        if(args.length < argNum) {\n          args = Arrays.copyOf(args, argNum);\n        }\n        args[argNum-1] = true;\n      }\n      else if (!part.isEmpty()) {\n        throw new IllegalArgumentException(JavaAnalysisBundle.message(\"mutation.signature.problem.invalid.token\", part));\n      }\n    }\n    return new MutationSignature(Kind.OTHER, mutatesThis, mutatesIO, args);\n  }\n\n  /**\n   * Checks the mutation signature\n   *\n   * @param signature signature to check\n   * @param method    a method to apply the signature","sourceCodeStart":224,"sourceCodeEnd":260,"githubUrl":"https://github.com/JetBrains/intellij-community/blob/be881553f2a76ac8b4ea53950d93f0de78295c19/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/MutationSignature.java#L224-L260","documentation":"IllegalArgumentException from MutationSignature.parse when a token in a 'mutates' signature string is not one of 'this', 'io', 'param', or 'paramN'. The parser splits the signature on separators and rejects anything else, including 'param' followed by a non-numeric suffix or a negative/out-of-range index. The signature describes which arguments/ receivers a method mutates (used by @Contract-style mutation contracts).","triggerScenarios":"Calling MutationSignature.parse (directly or via the mutation-contract annotation mechanism) with a string like \"this,foo\", \"param-1\", \"param999\", or a stray comma segment. Also 'paramN' where N parses outside 0..255.","commonSituations":"Hand-writing a mutates= attribute in an annotation and misspelling a token; using 'arg1' instead of 'param1'; copy-pasting from different contract dialects; empty segments from trailing commas are tolerated, other junk is not.","solutions":["Use only the tokens 'this', 'io', 'param', or 'param1'..'param255' in the mutates string","Replace argN/argumentN style tokens with paramN","Remove stray tokens or typos after commas"],"exampleFix":"// before\nMutationSignature.parse(\"this, args1, io\")\n// after\nMutationSignature.parse(\"this, param1, io\")","handlingStrategy":"validation","validationCode":"private static final Pattern TOKEN = Pattern.compile(\"this|io|param(?:[1-9][0-9]{0,2})?\\\\s*\");\nstatic boolean isValidMutationSignature(String s) {\n  for (String part : s.split(\"[,;]\")) {\n    String t = part.trim();\n    if (!t.isEmpty() && !TOKEN.matcher(t).matches()) return false;\n  }\n  return true;\n}","typeGuard":null,"tryCatchPattern":"try { MutationSignature.parse(sig); } catch (IllegalArgumentException e) { /* report invalid token to annotation author */ }","preventionTips":["Use only 'this', 'io', 'param', 'param1'..'param255'","Validate signature strings in tests before shipping annotations"],"tags":["intellij","java-analysis","mutation-signature","contract","parsing"],"backgroundTag":null,"analyzedSha":"be881553f2a76ac8b4ea53950d93f0de78295c19","analyzedAt":"2026-08-14T14:13:06.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}