{"record":{"id":"19651bd2688c9560","repo":"NationalSecurityAgency/ghidra","slug":"error","errorCode":null,"errorMessage":"{}","messagePattern":"\\{\\}","errorType":"exception","errorClass":"NoSuchElementException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/ProposedUtils/src/main/java/ghidra/util/database/DBCachedObjectStore.java","lineNumber":982,"sourceCode":"\t\t\treturn doCreate(table.getKey());\n\t\t}\n\t\tcatch (IOException e) {\n\t\t\tadapter.dbError(e);\n\t\t\treturn null;\n\t\t}\n\t}\n\n\t/**\n\t * Get the column number given a column name\n\t * \n\t * @param name the name\n\t * @return the number (0-up index) for the column\n\t * @throws NoSuchElementException if no column with the given name exists\n\t */\n\tprotected int getColumnByName(String name) {\n\t\tint index = ArrayUtils.indexOf(schema.getFieldNames(), name);\n\t\tif (index < 0) {\n\t\t\tthrow new NoSuchElementException(name);\n\t\t}\n\t\treturn index;\n\t}\n\n\t/**\n\t * Get the table index for the given column number\n\t * \n\t * @param <K> the type of the object field for the indexed column\n\t * @param fieldClass the class specifying {@link K}\n\t * @param columnIndex the column number\n\t * @return the index\n\t * @throws IllegalArgumentException if the column has a different type than {@link K}\n\t */\n\tprotected <K> DBCachedObjectIndex<K, T> getIndex(Class<K> fieldClass, int columnIndex) {\n\t\tif (!ArrayUtils.contains(table.getIndexedColumns(), columnIndex)) {\n\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\"Column \" + schema.getFieldNames()[columnIndex] + \" is not indexed\");\n\t\t}","sourceCodeStart":964,"sourceCodeEnd":1000,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/ProposedUtils/src/main/java/ghidra/util/database/DBCachedObjectStore.java#L964-L1000","documentation":"Thrown (unchecked NoSuchElementException) by DBCachedObjectStore.getColumnByName() when the requested column name is not found among the store schema's field names (ArrayUtils.indexOf returns -1). The exception's message is the missing name. This is a programmer/config error: the name doesn't match the store's declared schema.","triggerScenarios":"Requesting a column index by a name that isn't a field in the store's schema — typo, stale name after a schema change, querying the wrong store, or a name from a different schema version.","commonSituations":"Schema evolution where a column was renamed/removed but caller still uses the old name; copy-paste of a column name from another object type; case mismatch; querying a store whose factory was configured with a different annotated object class.","solutions":["Validate the name against schema.getFieldNames() before lookup (e.g. Arrays.asList(schema.getFieldNames()).contains(name)).","Check for typos and exact case in the column name string.","Confirm you are operating on the correct store/schema (the annotated object class whose fields define the names).","After schema changes, regenerate/update callers that reference removed or renamed columns."],"exampleFix":"// before\nint col = store.getColumnByName(\"myFeild\"); // typo -> NoSuchElementException\n\n// after: validate against the schema first\nString name = \"myField\";\nif (!Arrays.asList(store.getSchema().getFieldNames()).contains(name)) {\n    throw new IllegalArgumentException(\"unknown column: \" + name);\n}\nint col = store.getColumnByName(name);","handlingStrategy":"validation","validationCode":"// Validate the column name against the schema first\nList<String> names = Arrays.asList(schema.getFieldNames());\nif (!names.contains(name)) {\n    // unknown column; fix typo or use the correct store/schema\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate names against schema.getFieldNames() before lookup.","Watch for typos and case mismatches in column names.","After schema changes, update callers referencing renamed/removed columns."],"tags":["database","schema","column-lookup","no-such-element","unchecked-exception"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}