{"record":{"id":"5ba3c6e0f522e872","repo":"denoland/deno","slug":"foreign-symbol-of-type-void-is-not-supported","errorCode":null,"errorMessage":"Foreign symbol of type 'void' is not supported","messagePattern":"Foreign symbol of type 'void' is not supported","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"ext/ffi/00_ffi.js","lineNumber":477,"sourceCode":"  symbols = { __proto__: null };\n\n  constructor(path, symbols) {\n    ({ 0: this.#rid, 1: this.symbols } = op_ffi_load(path, symbols));\n    for (const symbol in symbols) {\n      if (!ObjectHasOwn(symbols, symbol)) {\n        continue;\n      }\n\n      // Symbol was marked as optional, and not found.\n      // In that case, we set its value to null in Rust-side.\n      if (symbols[symbol] === null) {\n        continue;\n      }\n\n      if (ReflectHas(symbols[symbol], \"type\")) {\n        const type = symbols[symbol].type;\n        if (type === \"void\") {\n          throw new TypeError(\n            \"Foreign symbol of type 'void' is not supported\",\n          );\n        }\n\n        const name = symbols[symbol].name || symbol;\n        const value = op_ffi_get_static(\n          this.#rid,\n          name,\n          type,\n          symbols[symbol].optional,\n        );\n        ObjectDefineProperty(\n          this.symbols,\n          symbol,\n          {\n            __proto__: null,\n            configurable: false,\n            enumerable: true,","sourceCodeStart":459,"sourceCodeEnd":495,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/ext/ffi/00_ffi.js#L459-L495","documentation":"In Deno.dlopen(path, { symbols }), an entry with a type field declares a static data symbol to read from the library. \"void\" means 'no value', so a static of type void cannot be read; Deno rejects it while binding symbols. Function symbols (declared with parameters/result) are not affected.","triggerScenarios":"Deno.dlopen(\"./lib.so\", { handle: { type: \"void\", name: \"handle\" } }); bindings generated from C headers that emit void for globals; a function mistakenly declared with type instead of parameters/result.","commonSituations":"Auto-generated bindings from C headers; mixing up the static form ({ type }) and the function form ({ parameters, result }) of symbol declarations.","solutions":["Give the static symbol its real type (\"u32\", \"pointer\", ...) or delete the entry","If the symbol is a function, declare it with parameters/result, not type","For possibly-missing symbols, keep optional: true but with a valid type"],"exampleFix":"// before\nconst lib = Deno.dlopen(\"./lib.so\", {\n  version: { type: \"void\", name: \"VERSION\" },\n});\n\n// after\nconst lib = Deno.dlopen(\"./lib.so\", {\n  version: { type: \"pointer\", name: \"VERSION\" },\n});","handlingStrategy":"validation","validationCode":"function validateSymbols(symbols) {\n  for (const [key, s] of Object.entries(symbols)) {\n    if (s && \"type\" in s && s.type === \"void\") {\n      throw new Error(`static symbol '${key}' cannot have type \"void\"`);\n    }\n  }\n}\n\nvalidateSymbols(symbols);\nconst lib = Deno.dlopen(\"./lib.so\", symbols);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use { type } only for data symbols, { parameters, result } for functions","Give every static symbol a concrete type or remove it","Review generated bindings for void globals before loading"],"tags":["ffi","dlopen","symbols","static"],"backgroundTag":"invalid-type-name","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}