{"record":{"id":"6a7c5051dd842249","repo":"NationalSecurityAgency/ghidra","slug":"function-tag-does-not-exist","errorCode":null,"errorMessage":"Function tag does not exist: {}","messagePattern":"Function tag does not exist: (.+?)","errorType":"validation","errorClass":"InvalidInputException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/gui/filters/FunctionTagBSimFilterType.java","lineNumber":79,"sourceCode":"\t * function tag is. If that's the case, this will figure it out from the\n\t * given queryService object. \n\t * \n\t * @param tagName the name of the tag\n\t * @param queryService query service used to retrieve tag big position\n\t * @throws InvalidInputException thrown if tag does not exist\n\t */\n\tpublic FunctionTagBSimFilterType(String tagName, SimilarFunctionQueryService queryService)\n\t\tthrows InvalidInputException {\n\t\tsuper(\"Function tagged as \" + tagName, XML_VALUE, \"function tag\");\n\t\tthis.tagName = tagName;\n\n\t\tDatabaseInformation info = queryService.getDatabaseInformation();\n\t\tif (info == null) {\n\t\t\tthrow new IllegalStateException(\"queryService has not been initialized\");\n\t\t}\n\t\tList<String> functionTags = info.functionTags;\n\t\tif (functionTags == null) {\n\t\t\tthrow new InvalidInputException(\"Function tag does not exist: \" + tagName);\n\t\t}\n\n\t\tflag = 8;\n\t\tfor (String tag : functionTags) {\n\t\t\tif (tag.endsWith(tagName)) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tflag = flag * 2;\n\t\t}\n\t}\n\n\tpublic int getFlag() {\n\t\treturn flag;\n\t}\n\n\t@Override\n\tpublic int hashCode() {\n\t\tfinal int prime = 31;","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/gui/filters/FunctionTagBSimFilterType.java#L61-L97","documentation":"FunctionTagBSimFilterType constructor checks info.functionTags from the database's DatabaseInformation; if the list is null it throws InvalidInputException because the tag cannot be validated. A null functionTags list means the database was not configured to track function tags (the metadata field was never populated during database creation/ingestion). Note the check is for null specifically — an empty list would pass this guard but the subsequent loop would not find the tag.","triggerScenarios":"Constructing a new FunctionTagBSimFilterType(tagName, queryService) where queryService.getDatabaseInformation().functionTags is null. This happens when the BSim database was created without function tag support enabled.","commonSituations":"The BSim database was created with an older configuration template that doesn't include function tags; the database was created before function tag support was added to BSim; the database's metadata was never updated to include functionTags after adding tags to executables; the user is querying a database that was populated by a GenSignatures run that didn't emit tag metadata.","solutions":["Recreate or upgrade the BSim database with a configuration template that includes function tag tracking.","Re-ingest executables into the database using a current GenSignatures configuration that records function tags.","Verify info.functionTags is populated by checking DatabaseInformation after database initialization — if null, the DB predates tag support.","Update the database metadata (if the DB schema supports it) to initialize the functionTags list before constructing this filter."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"DatabaseInformation info = queryService.getDatabaseInformation();\nif (info == null || info.functionTags == null) {\n    // Database does not support function tags — do not offer this filter\n    throw new IllegalStateException(\n        \"BSim database '\" + info.name + \"' has no function tag metadata. \" +\n        \"Re-ingest with tag support enabled.\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    new FunctionTagBSimFilterType(tagName, queryService);\n} catch (InvalidInputException e) {\n    if (e.getMessage().startsWith(\"Function tag does not exist\")) {\n        // hide/disable the tag filter UI element\n    } else {\n        throw e;\n    }\n}","preventionTips":["Create BSim databases with a current configuration template that includes function tags.","Check info.functionTags != null before offering tag-based filters in the UI.","Re-ingest executables when function tag support is added to an existing database.","Document which config templates enable function tag tracking."],"tags":["bsim","function-tags","filter","database-metadata","configuration"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}