{"record":{"id":"0b5517b684660b5a","repo":"NationalSecurityAgency/ghidra","slug":"ioexception-message","errorCode":null,"errorMessage":"IOException message","messagePattern":"IOException message","errorType":"exception","errorClass":"ElasticException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/elastic/ElasticDatabase.java","lineNumber":715,"sourceCode":"\t\t\t}\n\t\t\tvecRes = iter2.next();\n\t\t\tJsonObject oneResp = (JsonObject) docs.get(i);\n\t\t\tString matchId = oneResp.get(\"_id\").getAsString();\n\t\t\tlong matchIdVal = Base64Lite.decodeLongBase64(matchId);\n\t\t\tif (matchIdVal != vecRes.vectorid) {\n\t\t\t\tthrow new ElasticException(\"Mismatch in vectorid\");\n\t\t\t}\n\t\t\tJsonElement source = oneResp.get(\"_source\");\n\t\t\tif (ElasticConnection.isNull(source)) {\n\t\t\t\tthrow new ElasticException(\"vector document does not exist for id=\" + matchId);\n\t\t\t}\n\t\t\tStringReader reader =\n\t\t\t\tnew StringReader(((JsonObject) source).get(\"features\").getAsString());\n\t\t\ttry {\n\t\t\t\tvecRes.vec = vectorFactory.restoreVectorFromBase64(reader, vectorDecodeBuffer);\n\t\t\t}\n\t\t\tcatch (IOException e) {\n\t\t\t\tthrow new ElasticException(e.getMessage());\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Given a list of FunctionDescriptions, fill in the matching SignatureRecords\n\t * @param listFunctions is the list of functions\n\t * @param manager is the FunctionDescription container\n\t * @throws ElasticException for communication problems with the server\n\t */\n\tprivate void queryAssociatedSignatures(List<FunctionDescription> listFunctions,\n\t\t\tDescriptionManager manager) throws ElasticException {\n\t\tTreeMap<Long, VectorResult> vecMap = new TreeMap<>();\n\t\tfor (FunctionDescription fdesc : listFunctions) {\t\t\t\t// Collect (unique) vectorids across FunctionDescriptions\n\t\t\tif (fdesc.getSignatureRecord() != null) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tLong key = Long.valueOf(fdesc.getVectorId());","sourceCodeStart":697,"sourceCodeEnd":733,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/elastic/ElasticDatabase.java#L697-L733","documentation":"While decoding a stored feature vector for a queried function, vectorFactory.restoreVectorFromBase64 throws IOException; it is wrapped as ElasticException(e.getMessage()). The vector document's _source.features blob is present but not valid base64 or does not decode to the expected vector length.","triggerScenarios":"The query/associated-signature path fetches a vector document whose 'features' field fails to decode via the configured Base64VectorFactory (truncated base64, wrong byte length, or charset corruption).","commonSituations":"Index corruption; a partial write of a vector document from a crashed/interrupted ingest; version skew between the vector factory (weights/settings template) used to write vs to read; manual edits to the index.","solutions":["Re-ingest the affected executable(s) after dropping them so the vector is rewritten.","Verify the database 'settings' string and weight template match the client's configured vector factory.","If corruption is widespread, recreate the BSim database from source executables."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Confirm the client's vector factory settings match the database's stored settings before querying.\nif (!clientSettings.equals(db.getSettings())) {\n    throw new IllegalStateException(\"Vector factory settings differ from database; decoding will fail\");\n}","typeGuard":"// Predicate: can this client decode this database's vectors?\nboolean compatible = clientFactory.getSettings().equals(storedDbSettings);","tryCatchPattern":"// Wrap vector decode failures; mark the executable for re-ingest.\ntry {\n    db.querySimilar(req);\n} catch (ElasticException e) {\n    if (looksLikeDecodeFailure(e)) scheduleReingest(offendingExe);\n    else throw e;\n}","preventionTips":["Pin the BSim client version to the one that ingested the database.","Never hand-edit documents in the ES index.","Run ingest atomically per executable to avoid truncated vector writes."],"tags":["bsim","elasticsearch","corruption","decoding"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}