{"record":{"id":"1eb3f06516aa9906","repo":"NationalSecurityAgency/ghidra","slug":"null-datatype-passed-to-getisfobject","errorCode":null,"errorMessage":"Null datatype passed to getIsfObject","messagePattern":"Null datatype passed to getIsfObject","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger-isf/src/main/java/ghidra/program/model/data/ISF/IsfDataTypeWriter.java","lineNumber":374,"sourceCode":"\t\t\tresolved.put(dt, isf);\n\t\t\treturn jobj;\n\t\t}\n\t\treturn null;\n\t}\n\n\t/**\n\t * Writes the data type as ISF JSON using the underlying writer. For now,\n\t * ignoring top-level bit-fields and function defs as unsupported by ISF.\n\t * Typedefs really deserve their own category, but again unsupported.\n\t * \n\t * @param dt      the data type to write as ISF JSON\n\t * @param monitor the task monitor\n\t * @throws IOException if there is an exception writing the output\n\t */\n\tprotected IsfObject getIsfObject(DataType dt, TaskMonitor monitor)\n\t\t\tthrows IOException, CancelledException {\n\t\tif (dt == null) {\n\t\t\tthrow new IOException(\"Null datatype passed to getIsfObject\");\n\t\t}\n\t\tif (dt instanceof FactoryDataType) {\n\t\t\tMsg.error(this, \"Factory data types may not be written - type: \" + dt);\n\t\t}\n\t\tif (dt instanceof BitFieldDataType) {\n\t\t\tMsg.error(this, \"BitField data types may not be written - type: \" + dt);\n\t\t}\n\t\tif (dt instanceof Pointer || dt instanceof Array) {\n\t\t\tIsfObject type = getObjectDataType(IsfUtilities.getBaseDataType(dt));\n\t\t\tIsfObject obj = newTypedObject(dt, type);\n\t\t\treturn obj;\n\t\t}\n\n\t\tdt = dt.clone(dtm); // force resize/repack for target data organization\n\n\t\tIsfObject res = resolve(dt);\n\t\tif (res != null) {\n\t\t\treturn res;","sourceCodeStart":356,"sourceCodeEnd":392,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-isf/src/main/java/ghidra/program/model/data/ISF/IsfDataTypeWriter.java#L356-L392","documentation":"IOException('Null datatype passed to getIsfObject') thrown at the top of IsfDataTypeWriter.getIsfObject when dt == null. The writer cannot serialize a null DataType to ISF JSON, so it fails fast. Note it only guards null; FactoryDataType and BitFieldDataType are logged as errors but not thrown.","triggerScenarios":"getIsfObject(dt, monitor) is called with a null DataType, e.g. a category/typedef resolution returning null, a list iteration containing a null entry, or an unresolved dependent type passed straight through.","commonSituations":"Walking a data type manager where some referenced types are unresolved (null); scripted export feeding a filtered list that includes nulls; pointer/array base type resolution returning null via IsfUtilities.getBaseDataType before newTypedObject is built.","solutions":["Filter null data types out of the input set before iterating and calling getIsfObject.","Resolve/validate each DataType is non-null (and not a FactoryDataType/BitFieldDataType if those are unsupported for your export) before writing.","Log which category/path produced the null so the unresolved type can be fixed in the program/archive."],"exampleFix":"// before\nfor (DataType dt : types) {\n    IsfObject o = writer.getIsfObject(dt, monitor);\n}\n\n// after\nfor (DataType dt : types) {\n    if (dt == null) {\n        Msg.warn(this, \"Skipping null data type during ISF export\");\n        continue;\n    }\n    IsfObject o = writer.getIsfObject(dt, monitor);\n}","handlingStrategy":"type-guard","validationCode":"for (DataType dt : types) {\n    if (dt == null) continue;\n    writer.getIsfObject(dt, monitor);\n}","typeGuard":"boolean isWritable(DataType dt) {\n    return dt != null\n        && !(dt instanceof FactoryDataType)\n        && !(dt instanceof BitFieldDataType);\n}","tryCatchPattern":"try {\n    writer.getIsfObject(dt, monitor);\n} catch (IOException e) {\n    if (e.getMessage().contains(\"Null datatype\")) {\n        // skip null entries in the export set\n    }\n}","preventionTips":["Filter null (and FactoryDataType/BitFieldDataType) entries out before exporting.","Resolve dependent types and log any that come back null.","Validate the data type set at the boundary of the export routine."],"tags":["ghidra","isf","data-type","export","validation","null-check"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}