{"record":{"id":"5f8c74b2803d3591","repo":"slimtoolkit/slim","slug":"no-external-network-s","errorCode":null,"errorMessage":"no external network - %s","messagePattern":"no external network - (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/app/master/compose/execution.go","lineNumber":1721,"sourceCode":"\t//not using config.Ipam for now\n\n\tfilter := dockerapi.NetworkFilterOpts{\n\t\t\"name\": map[string]bool{\n\t\t\tfullName: true,\n\t\t},\n\t}\n\n\tlog.Debugf(\"createNetwork(%s,%s): lookup '%s'\", projectName, name, fullName)\n\n\tnetworkList, err := apiClient.FilteredListNetworks(filter)\n\tif err != nil {\n\t\tlog.Debugf(\"listNetworks(%s): dockerapi.FilteredListNetworks() error = %v\", name, err)\n\t\treturn false, \"\", err\n\t}\n\n\tif len(networkList) == 0 || networkList[0].Name != fullName {\n\t\tif mustFind {\n\t\t\treturn false, \"\", fmt.Errorf(\"no external network - %s\", fullName)\n\t\t}\n\n\t\tlog.Debugf(\"createNetwork(%s,%s): create '%s'\", projectName, name, options.Name)\n\t\tnetworkInfo, err := apiClient.CreateNetwork(options)\n\t\tif err != nil {\n\t\t\tlog.Debugf(\"apiClient.CreateNetwork() error = %v\", err)\n\t\t\treturn false, \"\", err\n\t\t}\n\n\t\treturn true, networkInfo.ID, nil\n\t}\n\n\tlog.Debugf(\"createNetwork(%s,%s): found network '%s' (id=%s)\", projectName, name, fullName, networkList[0].ID)\n\treturn false, networkList[0].ID, nil\n}\n\nfunc (ref *Execution) DeleteNetworks() error {\n\tfor key, network := range ref.ActiveNetworks {","sourceCodeStart":1703,"sourceCodeEnd":1739,"githubUrl":"https://github.com/slimtoolkit/slim/blob/81940d17fa112cc678e32209214bcb2355cb3004/pkg/app/master/compose/execution.go#L1703-L1739","documentation":"When a compose service references an external network, listNetworks/findNetwork checks that a network with the expected full name exists. If the network list is empty or the first match's name differs, and the caller required the network (mustFind, i.e. it was declared external), it returns 'no external network - %s'. External networks are never created, so a missing one is fatal.","triggerScenarios":"Starting a project that declares `networks: { x: { external: true } }` where no Docker network named (project-scoped full) name exists on the daemon.","commonSituations":"Fresh machines/environments where the pre-created network was never made; network created under a different name or in a different Docker context; leftover compose project prefixing changing the expected fullName; Docker host switched (e.g. different DOCKER_HOST).","solutions":["Create the external network first: docker network create <name> (matching the fullName the tool expects)","Verify the network name in the compose file matches an existing network (docker network ls), including any project-name prefixing","Check you're using the same Docker host/context where the network exists (DOCKER_HOST, docker context)"],"exampleFix":"// before\ndocker compose -p myproj up   # compose declares external net 'shared' that doesn't exist\n// after\ndocker network create shared\ndocker compose -p myproj up","handlingStrategy":"validation","validationCode":"func ensureExternalNetwork(name string) error {\n    cli, _ := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())\n    if _, err := cli.NetworkInspect(context.Background(), name, types.NetworkInspectOptions{}); err != nil {\n        var notFound objectNotFoundError\n        if errors.As(err, &notFound) {\n            return cli.NetworkCreate(context.Background(), name, types.NetworkCreate{CheckDuplicate: true})\n        }\n        return err\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"if err := execution.StartServices(ctx); err != nil {\n    if strings.HasPrefix(err.Error(), \"no external network - \") {\n        net := strings.TrimPrefix(err.Error(), \"no external network - \")\n        return fmt.Errorf(\"run 'docker network create %s' first: %w\", net, err)\n    }\n    return err\n}","preventionTips":["Provision external networks as part of environment setup before compose up","Verify network names with `docker network ls`, accounting for project-name prefixes","Pin the Docker host/context (DOCKER_HOST) so you check the same daemon you deploy to","Document required external networks in the project's setup scripts"],"tags":["docker","compose","networking"],"backgroundTag":"missing-external-network","analyzedSha":"81940d17fa112cc678e32209214bcb2355cb3004","analyzedAt":"2026-08-31T23:06:12.682Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}