{"record":{"id":"9bee1a571d5578ce","repo":"oven-sh/bun","slug":"variable-not-found","errorCode":null,"errorMessage":"Variable not found.","messagePattern":"Variable not found\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/bun-debug-adapter-protocol/src/debugger/adapter.ts","lineNumber":1827,"sourceCode":"    if (!variable) {\n      variables = [];\n    } else if (Array.isArray(variable)) {\n      variables = variable;\n    } else {\n      variables = await this.#getProperties(variable, start, count);\n    }\n\n    return {\n      variables: variables.sort(variablesSortBy),\n    };\n  }\n\n  async setVariable(request: DAP.SetVariableRequest): Promise<DAP.SetVariableResponse> {\n    const { variablesReference, name, value } = request;\n\n    const variable = this.#getVariable(variablesReference);\n    if (!variable) {\n      throw new Error(\"Variable not found.\");\n    }\n\n    const { objectId, objectGroup } = variable;\n    if (!objectId) {\n      throw new Error(\"Variable cannot be modified.\");\n    }\n\n    const { result, wasThrown } = await this.send(\"Runtime.callFunctionOn\", {\n      objectId,\n      functionDeclaration: `function (name) { this[name] = ${value}; return this[name]; }`,\n      arguments: [{ value: name }],\n      doNotPauseOnExceptionsAndMuteConsole: true,\n    });\n\n    if (wasThrown) {\n      throw new Error(remoteObjectToString(result));\n    }\n","sourceCodeStart":1809,"sourceCodeEnd":1845,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/packages/bun-debug-adapter-protocol/src/debugger/adapter.ts#L1809-L1845","documentation":"Error \"Variable not found.\" thrown in oven-sh/bun.","triggerScenarios":"Thrown at packages/bun-debug-adapter-protocol/src/debugger/adapter.ts:1827 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}