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): ?stringView on GitHub (pinned to c435d285c9)
Solutions
- Remove the package directory under vendor/ and re-run composer install for a fresh checkout.
- Avoid scripts that delete VCS metadata (.svn/.git/.hg) from vendor.
- Run `composer install --prefer-source` to recreate the checkout.
- 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
- Never strip .svn (or .git/.hg) from vendor directories.
- If a checkout looks partial, remove it and reinstall from source.
- Avoid scripts that 'clean' VCS metadata out of vendor.
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
- {svn error message}
- svn was not found in your PATH, skipping source download
- '.$package->getPrettyName().' could not be downloaded, '.$e-
- Update aborted
- Failed to execute {command}\n\n{processErrorOutput}
AI-assisted analysis of composer/composer@c435d285c9 (2026-08-07).
Data as JSON: /api/errors/3b43c90d8e5d472c.
Report an issue: GitHub.