{"record":{"id":"3b17706f24bdff4d","repo":"oracle/graal","slug":"no-opcode-for-s","errorCode":null,"errorMessage":"No opcode for %s","messagePattern":"No opcode for (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/bytecode/Bytecodes.java","lineNumber":635,"sourceCode":"            return \"<illegal opcode: \" + opcode + \">\";\n        }\n        return name;\n    }\n\n    /**\n     * Gets the opcode corresponding to a given mnemonic.\n     *\n     * @param name an opcode mnemonic\n     * @return the opcode corresponding to {@code mnemonic}\n     * @throws IllegalArgumentException if {@code name} does not denote a valid opcode\n     */\n    public static int valueOf(String name) {\n        for (int opcode = 0; opcode < nameArray.length; ++opcode) {\n            if (name.equalsIgnoreCase(nameArray[opcode])) {\n                return opcode;\n            }\n        }\n        throw new IllegalArgumentException(\"No opcode for \" + name);\n    }\n\n    /**\n     * Determines if a given opcode is an instruction that has a 2 or 4 byte operand that is an\n     * offset to another instruction in the same method. This does not include the\n     * {@linkplain #TABLESWITCH switch} instructions.\n     *\n     * @param opcode an opcode to test\n     * @return {@code true} iff {@code opcode} is a branch instruction with a single operand\n     */\n    public static boolean isBranch(int opcode) {\n        return (flagsArray[opcode & 0xff] & BRANCH) != 0;\n    }\n\n    /**\n     * Determines if a given opcode denotes a conditional branch.\n     *\n     * @param opcode","sourceCodeStart":617,"sourceCodeEnd":653,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/bytecode/Bytecodes.java#L617-L653","documentation":"Bytecodes.valueOf(String) maps an opcode mnemonic (e.g. \"IADD\", \"invokedynamic\") back to its numeric opcode by scanning the internal name table, ignoring case. If the string does not match any known JVM opcode mnemonic it throws IllegalArgumentException. The accepted set is exactly the standard JVMS opcode mnemonic list held in Bytecodes.nameArray.","triggerScenarios":"Calling Bytecodes.valueOf with a misspelled mnemonic (\"IADD \" with whitespace, \"iaddx\"), a pseudo-instruction name that is not a real opcode, or an instruction name from a non-JVM bytecode (Dalen, WASM). Whitespace is not trimmed and unknown names have no fuzzy matching.","commonSituations":"Tooling that parses textual bytecode or user-supplied opcode lists; configuration files listing opcodes by name where a typo or a JVM-version-specific opcode (e.g. a newly constant-folded instruction) slips in. Also when porting code between JVM versions where the mnemonic table gained or lost entries.","solutions":["Correct the mnemonic to an exact (case-insensitive) JVM opcode name, e.g. Bytecodes.valueOf(\"IADD\").","Validate/normalize input against Bytecodes.nameOf(opcode) output or the JVMS mnemonic list before calling valueOf.","Trim surrounding whitespace from the string before the call; valueOf does not do it for you."],"exampleFix":"// before\nint op = Bytecodes.valueOf(\"iadd \"); // trailing space -> throws\n\n// after\nint op = Bytecodes.valueOf(\"iadd\".trim());","handlingStrategy":"validation","validationCode":"static boolean isKnownOpcode(String name) {\n    for (int op = 0; op <= Bytecodes.LAST_JAVA_OPCODE; op++) {\n        if (Bytecodes.nameOf(op).equalsIgnoreCase(name.trim())) {\n            return true;\n        }\n    }\n    return false;\n}\n// call before Bytecodes.valueOf(name.trim())","typeGuard":null,"tryCatchPattern":"try {\n    int opcode = Bytecodes.valueOf(name);\n} catch (IllegalArgumentException e) {\n    // report unknown mnemonic to the user / config author\n}","preventionTips":["Trim and uppercase user-supplied mnemonics before lookup.","Derive opcode lists from Bytecodes.nameOf rather than hardcoding mnemonic strings in config files."],"tags":["bytecode","opcode","illegal-argument","api-misuse"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}