{"record":{"id":"e30473fc3f8fd08d","repo":"iOfficeAI/AionUi","slug":"rule-file-not-found","errorCode":null,"errorMessage":"Rule file not found","messagePattern":"Rule file not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/desktop/src/renderer/pages/conversation/components/SkillRuleGenerator.tsx","lineNumber":84,"sourceCode":"\n      const flatList = result && result.length > 0 && result[0].children ? flattenFiles(result[0].children) : [];\n      // Sort by name\n      flatList.sort((a, b) => a.name.localeCompare(b.name));\n      setFiles(flatList);\n    } catch (error) {\n      console.error('Failed to load files:', error);\n      Message.error(t('conversation.skill_generator.load_error', { defaultValue: 'Failed to load files' }));\n    } finally {\n      setLoading(false);\n    }\n  };\n\n  const handleSelectFile = async (file: IDirOrFile) => {\n    setLoadingFile(true);\n    try {\n      const content = await ipcBridge.fs.readFile.invoke({ path: file.fullPath, workspace });\n      if (content == null) {\n        throw new Error('Rule file not found');\n      }\n      const prompt = `\nSystem Instruction: The user has explicitly loaded the following rule/skill. Please internalize and apply it to our conversation immediately.\n\nFilename: ${file.name}\n\nContent:\n\\`\\`\\`\n${content}\n\\`\\`\\`\n\nPlease acknowledge receiving this rule/skill and confirm you will apply it.\n      `.trim();\n\n      await ipcBridge.conversation.sendMessage.invoke({\n        input: prompt,\n        conversation_id: conversation_id,\n      });","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/iOfficeAI/AionUi/blob/711aa0550ee183ea495dc33e2c05c7943b70a60a/packages/desktop/src/renderer/pages/conversation/components/SkillRuleGenerator.tsx#L66-L102","documentation":"handleSelectFile in SkillRuleGenerator reads a user-picked file via ipcBridge.fs.readFile and throws 'Rule file not found' when the returned content is null/undefined. This indicates the file exists in the tree listing but its content could not be read (deleted between listing and read, permission denied, or binary/oversized content mapped to null).","triggerScenarios":"Selecting a file in LoadRuleModal whose read returns null: file deleted after the directory listing, unreadable permissions, or a path outside the active workspace.","commonSituations":"Rules/skills files edited externally or removed by a sync tool while the picker was open, workspace switched, or selecting very large or binary files the reader refuses.","solutions":["Confirm the rule file still exists and is a readable text file within the workspace","Reopen the picker to refresh the listing, then reselect","Check read permissions on the file and parent directories","For very large rule files, split them or reduce size"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const exists = await ipcBridge.fs.exists?.invoke({ path: file.fullPath });\nif (!exists) { message.error('File no longer exists'); return; }","typeGuard":null,"tryCatchPattern":"try { const c = await ipcBridge.fs.readFile.invoke(...); if (c == null) return; } catch { /* show retry */ }","preventionTips":["Refresh the file tree when the picker opens","Handle null reads as 'file unavailable' with an actionable message","Avoid selecting binary/oversized files as rule inputs"],"tags":["file-read","skill-rules","ipc","not-found"],"backgroundTag":"file-read-empty-result","analyzedSha":"711aa0550ee183ea495dc33e2c05c7943b70a60a","analyzedAt":"2026-08-28T07:56:06.558Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}