Fission-AI/OpenSpec · error · Error

Cannot verify dangling symbolic link

Error message

Cannot verify dangling symbolic link: ${existingPath}

What it means

Thrown by canonicalizePotentialPath when a path segment being resolved is a dangling symbolic link (lstat succeeds on the link, realpath fails because the target is missing). Containment cannot be proven for a dangling link, so resolution fails closed.

Solutions

  1. Delete or repair the dangling symlink named in the message
  2. Recreate the symlink's target so realpath can resolve it
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/utils/file-system.ts:170 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Fission-AI/OpenSpec@6926ccb18a (2026-08-25). Data as JSON: /api/errors/a865409fb165663a. Report an issue: GitHub.

Appendix: source

Thrown at src/utils/file-system.ts:170

    let existingPath = targetPath;
    const missingSegments: string[] = [];

    while (true) {
      try {
        // lstat distinguishes a missing path from a dangling symlink. A
        // dangling link cannot be proven confined, so realpath must fail it.
        nodeFs.lstatSync(existingPath);
        const canonicalExisting = nodeFs.realpathSync.native(existingPath);
        return path.resolve(canonicalExisting, ...missingSegments);
      } catch (error) {
        const code = (error as NodeJS.ErrnoException).code;
        if (code !== 'ENOENT') {
          throw error;
        }

        try {
          if (nodeFs.lstatSync(existingPath).isSymbolicLink()) {
            throw new Error(`Cannot verify dangling symbolic link: ${existingPath}`);
          }
        } catch (lstatError) {
          if ((lstatError as NodeJS.ErrnoException).code !== 'ENOENT') {
            throw lstatError;
          }
        }

        const parent = path.dirname(existingPath);
        if (parent === existingPath) {
          throw new Error(`Cannot resolve an existing parent for ${targetPath}`);
        }
        missingSegments.unshift(path.basename(existingPath));
        existingPath = parent;
      }
    }
  }

  private static isWindowsBasePath(basePath: string): boolean {

View on GitHub (pinned to 6926ccb18a)