{"record":{"id":"1a10e2f74ed18c1d","repo":"NationalSecurityAgency/ghidra","slug":"missing-critical-configuration-value","errorCode":null,"errorMessage":"Missing critical configuration value: ","messagePattern":"Missing critical configuration value: ","errorType":"exception","errorClass":"ElasticException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/elastic/ElasticDatabase.java","lineNumber":2143,"sourceCode":"\t\t\t\tcontinue;\t\t// This might be the \"sequence\" document\n\t\t\t}\n\t\t\tres.put(key, value.getAsString());\n\t\t}\n\t\treturn res;\n\t}\n\n\t/**\n\t * Given a critical key in the database configuration, return its corresponding value\n\t * @param key is the configuration key\n\t * @param keyValue is the key/value map\n\t * @return the corresponding value\n\t * @throws ElasticException if the key is missing\n\t */\n\tprivate String getCriticalValue(String key, Map<String, String> keyValue)\n\t\t\tthrows ElasticException {\n\t\tString value = keyValue.get(key);\n\t\tif (value == null) {\n\t\t\tthrow new ElasticException(\"Missing critical configuration value: \" + key);\n\t\t}\n\t\treturn value;\n\t}\n\n\t/**\n\t * Write DatabaseInformation to database in one bulk request. If -k- and -L- are greater than zero, they are written as well\n\t * @param k (optional) is the database k parameter\n\t * @param L (optional) is the database L parameter\n\t * @throws ElasticException for communication problems with the server\n\t */\n\tprivate void writeBasicInfo(int k, int L) throws ElasticException {\n\t\tStringBuilder buffer = new StringBuilder();\n\t\tbuffer.append(\"{ \\\"index\\\": { \\\"_id\\\": \\\"name\\\" } }\\n\");\n\t\tbuffer.append(\"{ \\\"type\\\": \\\"keyvalue\\\", \\\"value\\\": \\\"\")\n\t\t\t\t.append(info.databasename)\n\t\t\t\t.append(\"\\\" }\\n\");\n\t\tbuffer.append(\"{ \\\"index\\\": { \\\"_id\\\": \\\"owner\\\" } }\\n\");\n\t\tbuffer.append(\"{ \\\"type\\\": \\\"keyvalue\\\",  \\\"value\\\": \\\"\")","sourceCodeStart":2125,"sourceCodeEnd":2161,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/elastic/ElasticDatabase.java#L2125-L2161","documentation":"Thrown in getCriticalValue when a required configuration key is absent from the key/value map loaded by readKeyValues. Critical keys include name, owner, description, major, minor, and settings. The missing key name is appended to the error message for diagnosis.","triggerScenarios":"During initialize() -> readBasicInfo, getCriticalValue is called for each required key against the HashMap populated from the configuration index. If keyValue.get(key) returns null for any critical key, this exception is thrown.","commonSituations":"Database created by an older or newer BSim version that uses a different set of configuration keys; a configuration document was manually deleted from the index; interrupted writeBasicInfo that wrote some but not all key/value documents.","solutions":["Read the missing key name from the error message and either re-add it to the configuration index manually or recreate the database.","Drop and recreate the database using a BSim client version compatible with the stored LAYOUT_VERSION.","Verify that the BSim client version matches the database schema version (compareLayout should return 0).","Inspect all configuration documents via curl GET <repo>_configuration/_search to see which keys are present."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Verify all critical configuration keys are present\nString[] requiredKeys = {\"name\", \"owner\", \"description\", \"major\", \"minor\", \"settings\"};\nfor (String key : requiredKeys) {\n    if (!keyValue.containsKey(key)) {\n        throw new IllegalStateException(\"Missing configuration key: \" + key);\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    database.initialize();\n} catch (ElasticException e) {\n    if (e.getMessage().startsWith(\"Missing critical configuration value:\")) {\n        String missingKey = e.getMessage().substring(e.getMessage().lastIndexOf(' ') + 1);\n        Msg.error(this, \"Configuration key '\" + missingKey + \"' is missing; database may need recreation.\");\n    }\n    throw e;\n}","preventionTips":["Use a consistent BSim version for database creation and querying to avoid configuration key mismatches.","After creation, inspect all configuration documents to confirm required keys are present.","Check compareLayout() returns 0 before querying to detect version incompatibility."],"tags":["elasticsearch","bsim","configuration","version-mismatch","initialization","missing-key"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}