{"record":{"id":"eb26ff016ddf95d5","repo":"Fission-AI/OpenSpec","slug":"error-instanceof-error-error-message-string-er","errorCode":null,"errorMessage":"error instanceof Error ? error.message : String(error)","messagePattern":"error instanceof Error \\? error\\.message : String\\(error\\)","errorType":"exception","errorClass":"TemplateLoadError","httpStatus":null,"severity":"error","filePath":"src/core/artifact-graph/instruction-loader.ts","lineNumber":226,"sourceCode":"  schemaName: string,\n  templatePath: string,\n  projectRoot?: string\n): string {\n  const schemaDir = getSchemaDir(schemaName, projectRoot);\n  if (!schemaDir) {\n    throw new TemplateLoadError(\n      `Schema '${schemaName}' not found`,\n      templatePath\n    );\n  }\n\n  const templatesDir = path.join(schemaDir, 'templates');\n  const templatePathOnDisk = path.join(templatesDir, templatePath);\n\n  try {\n    FileSystemUtils.assertPathWithin(templatesDir, templatePathOnDisk);\n  } catch (error) {\n    throw new TemplateLoadError(\n      error instanceof Error ? error.message : String(error),\n      templatePathOnDisk\n    );\n  }\n\n  if (!fs.existsSync(templatePathOnDisk)) {\n    throw new TemplateLoadError(\n      `Template not found: ${templatePathOnDisk}`,\n      templatePathOnDisk\n    );\n  }\n\n  const fullPath = FileSystemUtils.canonicalizeExistingPath(templatePathOnDisk);\n\n  try {\n    return fs.readFileSync(fullPath, 'utf-8');\n  } catch (err) {\n    const ioError = err instanceof Error ? err : new Error(String(err));","sourceCodeStart":208,"sourceCodeEnd":244,"githubUrl":"https://github.com/Fission-AI/OpenSpec/blob/6926ccb18afa4ff621112813e9968334576ee11a/src/core/artifact-graph/instruction-loader.ts#L208-L244","documentation":"Error \"error instanceof Error ? error.message : String(error)\" thrown in Fission-AI/OpenSpec.","triggerScenarios":"Thrown at src/core/artifact-graph/instruction-loader.ts:226 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":"6926ccb18afa4ff621112813e9968334576ee11a","analyzedAt":"2026-08-25T12:29:45.729Z","schemaVersion":2},"datasetVersion":"2026-08-25T16:17:27.014Z"}