iOfficeAI/AionUi · error · Error

Rule file not found

Error message

Rule file not found

What it means

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).

Source

Thrown at packages/desktop/src/renderer/pages/conversation/components/SkillRuleGenerator.tsx:84

      const flatList = result && result.length > 0 && result[0].children ? flattenFiles(result[0].children) : [];
      // Sort by name
      flatList.sort((a, b) => a.name.localeCompare(b.name));
      setFiles(flatList);
    } catch (error) {
      console.error('Failed to load files:', error);
      Message.error(t('conversation.skill_generator.load_error', { defaultValue: 'Failed to load files' }));
    } finally {
      setLoading(false);
    }
  };

  const handleSelectFile = async (file: IDirOrFile) => {
    setLoadingFile(true);
    try {
      const content = await ipcBridge.fs.readFile.invoke({ path: file.fullPath, workspace });
      if (content == null) {
        throw new Error('Rule file not found');
      }
      const prompt = `
System Instruction: The user has explicitly loaded the following rule/skill. Please internalize and apply it to our conversation immediately.

Filename: ${file.name}

Content:
\`\`\`
${content}
\`\`\`

Please acknowledge receiving this rule/skill and confirm you will apply it.
      `.trim();

      await ipcBridge.conversation.sendMessage.invoke({
        input: prompt,
        conversation_id: conversation_id,
      });

View on GitHub (pinned to 711aa0550e)

Solutions

  1. Confirm the rule file still exists and is a readable text file within the workspace
  2. Reopen the picker to refresh the listing, then reselect
  3. Check read permissions on the file and parent directories
  4. For very large rule files, split them or reduce size
Defensive patterns

Strategy: validation

Validate before calling

const exists = await ipcBridge.fs.exists?.invoke({ path: file.fullPath });
if (!exists) { message.error('File no longer exists'); return; }

Try / catch

try { const c = await ipcBridge.fs.readFile.invoke(...); if (c == null) return; } catch { /* show retry */ }

Prevention

When it happens

Trigger: Selecting a file in LoadRuleModal whose read returns null: file deleted after the directory listing, unreadable permissions, or a path outside the active workspace.

Common situations: 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.

Related errors


AI-assisted analysis of iOfficeAI/AionUi@711aa0550e (2026-08-28). Data as JSON: /api/errors/e30473fc3f8fd08d. Report an issue: GitHub.