{"record":{"id":"b51c83f2690ea8d8","repo":"different-ai/openwork","slug":"string-name-is-not-available-in-codemode","errorCode":null,"errorMessage":"String.${name} is not available in CodeMode.","messagePattern":"String\\.(.+?) is not available in CodeMode\\.","errorType":"exception","errorClass":"InterpreterRuntimeError","httpStatus":null,"severity":"error","filePath":"packages/codemode/src/stdlib/string.ts","lineNumber":49,"sourceCode":"  \"search\",\n  \"localeCompare\",\n  \"normalize\",\n])\n\nexport const stringStatics = new Set([\"fromCharCode\", \"fromCodePoint\"])\n\nexport const invokeStringStatic = (name: string, args: Array<unknown>, node: AstNode): unknown => {\n  const codes = args.map((arg) => {\n    if (typeof arg !== \"number\") throw new InterpreterRuntimeError(`String.${name} expects number arguments.`, node)\n    return arg\n  })\n  switch (name) {\n    case \"fromCharCode\":\n      return String.fromCharCode(...codes)\n    case \"fromCodePoint\":\n      return String.fromCodePoint(...codes)\n    default:\n      throw new InterpreterRuntimeError(`String.${name} is not available in CodeMode.`, node)\n  }\n}\nimport { type AstNode, InterpreterRuntimeError } from \"../interpreter/model.js\"\n","sourceCodeStart":31,"sourceCodeEnd":53,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/packages/codemode/src/stdlib/string.ts#L31-L53","documentation":"CodeMode only whitelists the String statics fromCharCode and fromCodePoint. Any other String.* static (e.g. String.raw, String.fromCharCode-adjacent helpers) is rejected by the sandbox to keep the exposed API surface minimal.","triggerScenarios":"Calling `String.raw`...`` or any static other than fromCharCode/fromCodePoint on the sandbox String object.","commonSituations":"Copying normal JS snippets into CodeMode that rely on String.raw or other statics; assuming the sandbox mirrors full ECMAScript.","solutions":["Use only fromCharCode or fromCodePoint.","Replace String.raw with an explicitly escaped string literal.","Build the needed helper in plain CodeMode code (e.g. a template literal instead of String.raw)."],"exampleFix":"// before\nconst p = String.raw`\\n\\t`\n// after\nconst p = \"\\\\n\\\\t\"","handlingStrategy":"validation","validationCode":"const stringStatics = new Set([\"fromCharCode\", \"fromCodePoint\"])\nif (!stringStatics.has(name)) throw new TypeError(`String.${name} unsupported in CodeMode`)","typeGuard":"const isAllowedStringStatic = (name) => [\"fromCharCode\", \"fromCodePoint\"].includes(name)","tryCatchPattern":"try { v = String.raw`\\n` } catch { v = \"\\\\n\" }","preventionTips":["Replace String.raw with escaped literals","Keep a mental whitelist of sandbox String statics","Lint sandbox scripts against forbidden APIs"],"tags":["codemode","string","sandbox","unsupported-api"],"backgroundTag":"api-not-available-in-sandbox","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}