iOfficeAI/AionUi · error
scm port not configured
Error message
scm port not configured
What it means
`fetchScmDiff` requires a live port to the source-control backend; this error fires when the module-level `port` variable is unset, i.e. the SCM IPC/connection was never initialized (or was torn down) before a diff was requested.
Source
Thrown at packages/desktop/src/renderer/pages/conversation/SourceControl/scmStore.ts:615
/** Dismiss the current report without touching anything else. */
export const clearScmActionReport = (): void => {
actionReport = null;
commit();
};
/** The last action's inputs, for `retry`. Survives a panel remount. */
export const getLastScmAction = (): { action: ScmActionKind; repoId: string; resources: ScmResource[] } | null =>
lastAction;
/** Request a file diff (`scm/diff`). Request-driven: not part of the subscription. */
export const fetchScmDiff = async (params: {
repository: string;
file: ScmFileRef;
from: ContentRef;
to: ContentRef;
}): Promise<ScmDiffResult> => {
if (!port) throw new Error('scm port not configured');
return port.diff(params);
};
/**
* Reconnect: the backend dropped this connection's whole subscription set, so
* clear the declared set and re-declare from the repo list (mirrors the
* explorer's `current = ∅` re-declare). Statuses are kept as stale paint until
* the fresh first frames arrive.
*
* `appliedSeq` is cleared too: seq is per-repo *per backend runtime* and a
* reconnect may hit a restarted backend whose seq restarts at 1 — keeping the old
* high-water mark would make the guard discard every fresh frame, leaving the
* panel permanently stale.
*/
export const onScmReconnect = (): void => {
subscribed = new Set();
appliedSeq = new Map();
if (repositories.length > 0) void subscribeRepos(repositories.map((r) => r.repo_id));View on GitHub (pinned to 711aa0550e)
Solutions
- Ensure the SCM store connect/initialization (which assigns `port`) is awaited before rendering diff views
- Check why `port` is unset: backend SCM service crash, failed IPC handshake, or skipped init
- Reconnect via the store's reconnect path (re-declare subscriptions from the repo list) before retrying the diff
- In tests, mock/seed the port instead of invoking fetchScmDiff cold
Example fix
// before
export const fetchScmDiff = async (params) => {
if (!port) throw new Error('scm port not configured');
return port.diff(params);
};
// after
export const fetchScmDiff = async (params) => {
if (!port) {
await connectScmPort(); // establish connection lazily
if (!port) throw new Error('scm port not configured');
}
return port.diff(params);
}; Defensive patterns
Strategy: validation
Validate before calling
if (!isScmConnected()) await connectScmPort(); // then call fetchScmDiff
Type guard
const hasScmPort = (): boolean => port !== null && port !== undefined;
Try / catch
catch (e) { if (e.message === 'scm port not configured') await reconnectScm(); else throw e; } Prevention
- Await SCM store initialization before mounting diff views
- Subscribe to disconnect events to gate diff requests
When it happens
Trigger: Calling `fetchScmDiff` before `connect`/init has established the SCM port, or after the port was cleared (disconnect/reset). Any diff request against a repository file without an active SCM bridge connection.
Common situations: Component mounts and immediately requests a diff before the SCM connection lifecycle completes; the SCM backend service failed to start so init never assigned the port; calling diff after a deliberate disconnect (e.g. in tests or during window teardown).
Related errors
- fork returned no conversation
- result?.msg || fallbackMessage
- Failed to flush feedback report${eventId ? ` (${eventId})` :
- File data not found
- Image file not found
AI-assisted analysis of iOfficeAI/AionUi@711aa0550e (2026-08-28).
Data as JSON: /api/errors/f3ecfa02315ca8c4.
Report an issue: GitHub.