pbakaus/impeccable · warning

[impeccable] Svelte component abort cleanup failed:

Error message

[impeccable] Svelte component abort cleanup failed:

What it means

When a Svelte component generation session is aborted, the cleanup path (teardown or orphan DOM removal) threw; the warning logs it. The rest of the abort path (hiding the shader overlay, disconnecting retry observers) still runs afterwards, so the failure is contained.

Solutions

  1. Reload the page to reset the live-mode session state.
  2. Retry the Svelte component generation after reload.
  3. If reproducible, check for duplicate data-impeccable-variants attributes matching the sessionId in the DOM.
  4. Report if it persists; the leftover overlay/observers are cleaned in the following lines.

Example fix

// before
if (orphan) orphan.remove();
// after (guard against already-detached nodes throwing)
if (orphan && orphan.isConnected) orphan.remove();
Defensive patterns

Strategy: try-catch

Validate before calling

function orphanStillThere(sessionId) {
  return !!document.querySelector('[data-impeccable-variants="' + sessionId + '"]');
}

Try / catch

try {
  teardownSvelteComponentSession(true);
} catch (err) {
  console.warn('[impeccable] Svelte component abort cleanup failed:', err);
} finally {
  hideShaderOverlay();
}

Prevention

When it happens

Trigger: Svelte component session abort handler runs teardownSvelteComponentSession(true) or removes the [data-impeccable-variants] orphan node; either throws (e.g. detached DOM, null session internals) and is caught at skill/scripts/live-browser.js:6136.

Common situations: User aborts generation while the component tree is mid-mount/unmount; hot-module-reload replaces the DOM between session start and abort; duplicated session IDs in the DOM.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


AI-assisted analysis of pbakaus/impeccable@f2c7051853 (2026-09-08). Data as JSON: /api/errors/fb45d30ef2c1ab27. Report an issue: GitHub.

Appendix: source

Thrown at skill/scripts/live-browser.js:6159

    if (state !== 'CYCLING') setLiveState('GENERATING');
    injectSvelteComponentsFromManifest(manifestPath, sessionId);
  }

  // Tear down a component preview that could not mount, WITHOUT touching
  // session identity. The old version cleared localStorage, nulled
  // currentSessionId, and reset to PICKING, which orphaned a session the server
  // still had in its journal and made every recovery path unreachable. The DOM
  // teardown and observer cleanup are still right; the state wipe never was.
  function abortSvelteComponentInjection(sessionId, details) {
    try {
      if (svelteComponentSession?.sessionId === sessionId) {
        teardownSvelteComponentSession(true);
      } else {
        const orphan = document.querySelector('[data-impeccable-variants="' + sessionId + '"]');
        if (orphan) orphan.remove();
      }
    } catch (err) {
      console.warn('[impeccable] Svelte component abort cleanup failed:', err);
    }
    hideShaderOverlay();
    if (pendingSvelteComponentRetryObserver) { pendingSvelteComponentRetryObserver.disconnect(); pendingSvelteComponentRetryObserver = null; }
    if (pendingVariantAnchorRetryObserver) { pendingVariantAnchorRetryObserver.disconnect(); pendingVariantAnchorRetryObserver = null; }
    // The generate submit armed a scroll lock and a variant observer; a page
    // the user cannot scroll, watched by a stale observer, is exactly the
    // wrong place to show a card asking them to act.
    stopScrollLock();
    if (variantObserver) { variantObserver.disconnect(); variantObserver = null; }
    removeVariantStateStylesheet();
    hideBar(true);
    // currentSessionId, the saved session, and the file metadata all survive on
    // purpose: Retry, a republish from the agent, and a page reload all need
    // them. saveSession keeps the localStorage cache in step with the server.
    saveSession();
    if (details) showMountErrorCard(sessionId, details);
    else if (!mountErrorState) {
      showMountErrorCard(sessionId, { message: 'Variants could not be mounted. Retry, or ask the agent to republish.' });

View on GitHub (pinned to f2c7051853)