{"record":{"id":"3fc2cf68a577976a","repo":"garrytan/gstack","slug":"cannot-edit-no-skill-for-host-cause-skill-do","errorCode":null,"errorMessage":"Cannot edit: no skill for ${host}.\nCause: skill does not exist in this project or global scope.\nAction: $B domain-skill save to create one first.","messagePattern":"Cannot edit: no skill for (.+?)\\.\nCause: skill does not exist in this project or global scope\\.\nAction: \\$B domain-skill save to create one first\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"browse/src/domain-skill-commands.ts","lineNumber":184,"sourceCode":"  return [\n    `# ${result.row.host} (${result.source} scope, ${result.row.state})`,\n    `# version: ${result.row.version}, used: ${result.row.use_count}×, flags: ${result.row.flag_count}`,\n    '',\n    result.row.body,\n  ].join('\\n');\n}\n\nasync function handleEdit(args: string[]): Promise<string> {\n  const host = args[0];\n  if (!host) {\n    throw new Error('Usage: $B domain-skill edit <host>');\n  }\n  const slug = getCurrentProjectSlug();\n  // Read current body to seed the editor\n  const list = await listSkills(slug);\n  const current = [...list.project, ...list.global].find((r) => r.host === host);\n  if (!current) {\n    throw new Error(\n      `Cannot edit: no skill for ${host}.\\n` +\n        'Cause: skill does not exist in this project or global scope.\\n' +\n        'Action: $B domain-skill save to create one first.'\n    );\n  }\n  const editor = process.env.EDITOR || 'vi';\n  const tmpFile = path.join(os.tmpdir(), `gstack-domain-skill-${process.pid}-${Date.now()}.md`);\n  await fs.writeFile(tmpFile, current.body, 'utf8');\n  const result = spawnSync(editor, [tmpFile], { stdio: 'inherit' });\n  if (result.status !== 0) {\n    await fs.unlink(tmpFile).catch(() => {});\n    throw new Error(`Editor exited with status ${result.status}; no changes saved.`);\n  }\n  const newBody = await fs.readFile(tmpFile, 'utf8');\n  await fs.unlink(tmpFile).catch(() => {});\n  if (newBody === current.body) {\n    return `No changes for ${host}.`;\n  }","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/garrytan/gstack/blob/94993f74012782fd94416dd44b8314f6363a13a4/browse/src/domain-skill-commands.ts#L166-L202","documentation":"Error \"Cannot edit: no skill for ${host}.\nCause: skill does not exist in this project or global scope.\nAction: $B domain-skill save to create one first.\" thrown in garrytan/gstack.","triggerScenarios":"Thrown at browse/src/domain-skill-commands.ts:184 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":"94993f74012782fd94416dd44b8314f6363a13a4","analyzedAt":"2026-08-12T04:06:23.140Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}