jlcodes99/cockpit-tools · warning

[ExternalImport] 读取待处理导入请求失败:

Error message

[ExternalImport] 读取待处理导入请求失败:

What it means

On startup MainApp reads any pending external import request payload from the backend; the promise has a .catch that logs this warning and gives up. It means a queued external-provider import (e.g. from a deep link or another window) could not be read and is silently dropped — the user's intended import never happens.

Source

Thrown at src/App.tsx:3569

        unlisten();
      }
    };
  }, [handleExternalProviderImportRawPayload]);

  useEffect(() => {
    let canceled = false;
    void invoke<unknown>('external_import_take_pending')
      .then((payload) => {
        if (canceled) return;
        if (!payload) {
          console.info('[ExternalImport][App] 启动时无待处理导入 payload');
          return;
        }
        console.info('[ExternalImport][App] 启动时读取到待处理导入 payload');
        void handleExternalProviderImportRawPayload(payload);
      })
      .catch((error) => {
        console.warn('[ExternalImport] 读取待处理导入请求失败:', error);
      });
    return () => {
      canceled = true;
    };
  }, [handleExternalProviderImportRawPayload]);

  // 窗口拖拽处理
  const handleDragStart = (event: ReactMouseEvent<HTMLDivElement>) => {
    if (event.button !== 0) {
      return;
    }
    void getCurrentWindow().startDragging().catch((error) => {
      console.warn('[Window] startDragging failed:', error);
    });
  };

  useEffect(() => {
    const handleRequestNavigate = (e: Event) => {

View on GitHub (pinned to 1ed8b77992)

Solutions

  1. Read the logged error: 'command not found' means a frontend/backend API mismatch; IO errors point at the pending-payload store
  2. Validate/handle a corrupt pending payload by deleting it and informing the user instead of failing silently
  3. Ensure the read happens after the backend is ready (await app readiness before the effect's invoke)
  4. Preserve the payload (don't clear it) on read failure so a retry on next launch can recover the import

Example fix

// before
.catch((error) => {
  console.warn('[ExternalImport] 读取待处理导入请求失败:', error);
});
// after
.catch((error) => {
  console.warn('[ExternalImport] 读取待处理导入请求失败:', error);
  notifyUserImportPendingButUnread(); // keep payload for retry on next launch
});
Defensive patterns

Strategy: fallback

Validate before calling

async function readPendingImportSafely(): Promise<RawImportPayload | null> {
  try {
    return await readPendingImportPayload();
  } catch (error) {
    console.warn('[ExternalImport] 读取待处理导入请求失败:', error);
    return null;
  }
}

Type guard

function isRawImportPayload(v: unknown): v is RawImportPayload {
  return isPlainObject(v) && typeof (v as { kind?: unknown }).kind === 'string';
}

Try / catch

readPendingImportPayload()
  .then((payload) => handleExternalProviderImportRawPayload(payload))
  .catch((error) => {
    console.warn('[ExternalImport] 读取待处理导入请求失败:', error);
    // keep the pending payload so the import can be retried on next launch
  });

Prevention

When it happens

Trigger: The startup read rejects: backend command/IPC failure, the pending-request store/file is corrupt or locked, permission error reading the payload, or the reader was invoked after cancellation with a stale handle.

Common situations: App crash left a partially written pending-import file; Tauri command renamed after an update so invoke fails; race where cleanup (`canceled = true`) closes before the read resolves on fast unmounts.

Related errors


AI-assisted analysis of jlcodes99/cockpit-tools@1ed8b77992 (2026-09-05). Data as JSON: /api/errors/c1707b19329759cf. Report an issue: GitHub.