composer/composer · error · RuntimeException

The .svn directory is missing from '.$path.', see https://ge

Error message

The .svn directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information

What it means

Thrown by SvnDownloader::doUpdate() when hasMetadataRepository($path) is false, i.e. the expected .svn directory is absent from the package's install path. An update requires an existing checkout to switch; without .svn metadata Composer cannot perform an in-place svn switch.

Source

Thrown at src/Composer/Downloader/SvnDownloader.php:75

            }
        }

        $this->io->writeError(" Checking out ".$package->getSourceReference());
        $this->execute($package, $url, ['svn', 'co'], sprintf("%s/%s", $url, $ref), null, $path);

        return \React\Promise\resolve(null);
    }

    /**
     * @inheritDoc
     */
    protected function doUpdate(PackageInterface $initial, PackageInterface $target, string $path, string $url): PromiseInterface
    {
        SvnUtil::cleanEnv();
        $ref = $target->getSourceReference();

        if (!$this->hasMetadataRepository($path)) {
            throw new \RuntimeException('The .svn directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
        }

        $util = new SvnUtil($url, $this->io, $this->config, $this->process);
        $flags = [];
        if (version_compare($util->binaryVersion(), '1.7.0', '>=')) {
            $flags[] = '--ignore-ancestry';
        }

        $this->io->writeError(" Checking out " . $ref);
        $this->execute($target, $url, array_merge(['svn', 'switch'], $flags), sprintf("%s/%s", $url, $ref), $path);

        return \React\Promise\resolve(null);
    }

    /**
     * @inheritDoc
     */
    public function getLocalChanges(PackageInterface $package, string $path): ?string

View on GitHub (pinned to c435d285c9)

Solutions

  1. Remove the package directory under vendor/ and re-run composer install for a fresh checkout.
  2. Avoid scripts that delete VCS metadata (.svn/.git/.hg) from vendor.
  3. Run `composer install --prefer-source` to recreate the checkout.
  4. See https://getcomposer.org/commit-deps as referenced in the message.
Defensive patterns

Strategy: validation

Validate before calling

// Before an SVN source update, confirm .svn metadata exists.
if (!is_dir($path.'/.svn')) {
    // re-create the checkout rather than attempting an update.
    $filesystem->removeDirectory($path);
    throw new \RuntimeException("No .svn metadata in $path; will re-download from scratch.");
}

Try / catch

try {
    $downloader->update($initial, $target, $path, $url);
} catch (\RuntimeException $e) {
    if (str_contains($e->getMessage(), 'The .svn directory is missing')) {
        // delete $path and call download() to re-checkout, then retry update
    } else {
        throw $e;
    }
}

Prevention

When it happens

Trigger: An update of a package that was previously installed from SVN source, but the .svn directory in vendor/<pkg> was removed, manually cleaned, or never created (e.g. install was interrupted or someone deleted VCS metadata).

Common situations: A prior cleanup script stripped .svn dirs from vendor; the package dir was partially deleted; an interrupted checkout left no metadata; switching from dist to source on an existing dist install.

Related errors


AI-assisted analysis of composer/composer@c435d285c9 (2026-08-07). Data as JSON: /api/errors/3b43c90d8e5d472c. Report an issue: GitHub.