{"record":{"id":"eae1cc83c9b3bf29","repo":"NationalSecurityAgency/ghidra","slug":"no-match-found","errorCode":null,"errorMessage":"No match found","messagePattern":"No match found","errorType":"exception","errorClass":"AssemblySemanticException","httpStatus":null,"severity":"info","filePath":"Ghidra/Features/Base/ghidra_scripts/AssemblyThrasherDevScript.java","lineNumber":92,"sourceCode":"\t\t\t\t}\n\t\t\t\tAssemblyResolvedPatterns can = (AssemblyResolvedPatterns) ar;\n\t\t\t\tif (can.getContext().combine(ctx) == null) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tfor (byte[] ins : can.possibleInsVals(ctx)) {\n\t\t\t\t\tString cantext = disassemble(orig, ins).toString().trim();\n\t\t\t\t\tif (cantext.equals(text)) {\n\t\t\t\t\t\tgotOne = true;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tsb.append(\"Mismatch: \" + NumericUtilities.convertBytesToString(ins) +\n\t\t\t\t\t\t\t\" => \" + cantext + \". \");\n\t\t\t\t\t\tfailedOne = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!gotOne) {\n\t\t\t\tthrow new AssemblySemanticException(\"No match found\");\n\t\t\t}\n\t\t\tif (failedOne) {\n\t\t\t\tthrow new AssemblySemanticException(sb.toString());\n\t\t\t}\n\t\t\t// Don't return, to avoid modifying the binary.\n\t\t\tthrow new Accept();\n\t\t}\n\t}\n\n\t@Override\n\tprotected void run() throws Exception {\n\t\tclearBackgroundColor(currentProgram.getMemory().getAllInitializedAddressSet());\n\n\t\tBookmarkManager bm = currentProgram.getBookmarkManager();\n\t\tIcon myIcon = Icons.WARNING_ICON;\n\t\tbm.defineType(BOOKMARK_FAIL, myIcon, Palette.YELLOW, 0);\n\t\tbm.removeBookmarks(BOOKMARK_FAIL);\n","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/Base/ghidra_scripts/AssemblyThrasherDevScript.java#L74-L110","documentation":"Thrown by AssemblyThrasherDevScript's AllMatchByTextSelector.select when no candidate encoding produced by the assembler round-trips to the same instruction text as the original. For each resolved pattern it disassembles the candidate bytes and compares toString(); if none equal the expected text, AssemblySemanticException(\"No match found\") is raised. This is an internal assembler test/diagnostic, not a user-facing API - it signals that the Sleigh assembler failed to reproduce a disassembled instruction.","triggerScenarios":"Running AssemblyThrasherDevScript against a program where the assembler cannot reconstruct an instruction's bytes from its text. Triggered when the instruction's displayed text includes context-dependent tokens the assembler cannot resolve, or when the Sleigh specification has gaps.","commonSituations":"Developing or upgrading a Sleigh language module. Running the thrasher against an unusual architecture variant. Encountering instructions whose rendering depends on context not captured by the assembler.","solutions":["Treat this as expected output: the script catches AssemblySemanticException and records a 'Semantic Error' bookmark - inspect the bookmark, not the exception.","Improve the Sleigh language definition for the failing instruction (the mismatch is logged).","If developing the assembler, run with the SleighDebugLogger to identify which constructor tree failed.","Skip instructions known to be non-round-trippable rather than failing the script."],"exampleFix":"// before - the selector throws inside asm.assemble(...)\ntry {\n    asm.assemble(ins.getAddress(), ins.toString());\n} catch (AssemblySemanticException e) {\n    // 'No match found' lands here\n}\n\n// after - the script already handles it; just record and continue\nbm.setBookmark(ins.getAddress(), BOOKMARK_FAIL, \"Semantic Error\", e.getMessage());\n// no code change needed; the throw is the script's signal path","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    asm.assemble(ins.getAddress(), ins.toString());\n} catch (AssemblySemanticException e) {\n    // expected signal of a non-round-trippable instruction\n    bm.setBookmark(ins.getAddress(), BOOKMARK_FAIL, \"Semantic Error\", e.getMessage());\n}","preventionTips":["Treat the throw as the script's normal signal path; it is caught and recorded.","When developing Sleigh, inspect the failure bookmark to improve the language definition.","Use SleighDebugLogger to localize the failing constructor."],"tags":["assembly","sleigh","testing","diagnostic"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}