nextcloud/all-in-one · critical · \Exception
Could not create the nextcloud-aio network: {details}
Error message
Could not create the nextcloud-aio network: {details} What it means
POST /networks/create for the nextcloud-aio bridge network failed with a RequestException whose code is NOT 409 — 409 (network already exists) is deliberately tolerated as success, making creation idempotent. The daemon's error body is embedded. After creation (or tolerance) the container is connected to this network, so a failure here blocks every container attach.
Source
Thrown at php/src/Docker/DockerActionManager.php:920
if ($createNetwork) {
$url = $this->BuildApiUrl('networks/create');
try {
$this->sendHttpRequest(
'POST',
$url,
[
'json' => [
'Name' => $network,
'CheckDuplicate' => true,
'Driver' => 'bridge',
'Internal' => false,
]
]
);
} catch (RequestException $e) {
// 409 is undocumented and gets thrown if the network already exists.
if ($e->getCode() !== 409) {
throw new \Exception("Could not create the nextcloud-aio network: " . $e->getResponse()?->getBody()->getContents());
}
}
}
$url = $this->BuildApiUrl(
sprintf('networks/%s/connect', $network)
);
$jsonPayload = ['Container' => $id];
if ($alias !== '') {
$jsonPayload['EndpointConfig'] = ['Aliases' => [$alias]];
}
try {
$this->sendHttpRequest(
'POST',
$url,
[
'json' => $jsonPayloadView on GitHub (pinned to 6b788eec5e)
Solutions
- List and remove leftovers: docker network ls | grep nextcloud-aio then docker network rm <name>, and retry
- If pools are exhausted: docker network prune unused networks, or extend default-address-pools in /etc/docker/daemon.json and restart docker
- Check the daemon logs (journalctl -u docker) for the underlying create failure
- Verify daemon.json network settings are valid before restarting the daemon
Example fix
// before: create and only tolerate 409
// after: pre-check existence, then create — fully idempotent
try {
$docker->sendHttpRequest('POST', $docker->BuildApiUrl('networks/create'), [
'json' => ['Name' => $network, 'CheckDuplicate' => true, 'Driver' => 'bridge', 'Internal' => false]
]);
} catch (RequestException $e) {
if ($e->getCode() !== 409) { throw $e; } // already exists → fine
} Defensive patterns
Strategy: fallback
Validate before calling
// Check existence first and reuse the existing network instead of creating
$nets = json_decode($docker->sendHttpRequest('GET', $docker->BuildApiUrl('networks'))->getBody(), true) ?: [];
$exists = in_array('nextcloud-aio', array_column($nets, 'Name'), true);
if (!$exists) {
$docker->sendHttpRequest('POST', $docker->BuildApiUrl('networks/create'), [
'json' => ['Name' => 'nextcloud-aio', 'CheckDuplicate' => true, 'Driver' => 'bridge', 'Internal' => false]
]);
}
// proceed to networks/{name}/connect either way Try / catch
try {
createNetworkAndConnect($id, $alias);
} catch (\Exception $e) {
if (str_contains($e->getMessage(), 'Could not create the nextcloud-aio network')) {
// address-pool exhaustion is the usual cause: report prune/daemon.json guidance verbatim
reportNetworkExhaustion($e->getMessage());
}
throw $e;
} Prevention
- Tolerate 409 (already exists) exactly as the library does — network creation must stay idempotent
- Prune unused docker networks regularly on hosts running many compose projects; default address pools exhaust silently
- Size default-address-pools in /etc/docker/daemon.json for your network count before deploying
When it happens
Trigger: Docker address-pool exhaustion ('all predefined address pools have been fully subnetted') when too many networks exist; daemon/network-driver errors; invalid network configuration in daemon.json; a same-name network in a broken state that 409 does not cover.
Common situations: Hosts running many compose projects or containers exhausting the default 172.17-31.x space; leftover half-created networks; custom default-address-pools config too small.
Related errors
- Could not start container {identifier}: {details}
- Could not create container {identifier}: {details}
- ${DataConst::GetDataDirectory()} does not exist! Something w
- ${DataConst::GetDataDirectory()} does not have enough space
- Could not pull image {imageName} (attempt {attempt}/{maxRetr
AI-assisted analysis of nextcloud/all-in-one@6b788eec5e (2026-08-21).
Data as JSON: /api/errors/0d0242d762a788c4.
Report an issue: GitHub.