{"record":{"id":"30e380131ef3c660","repo":"slimtoolkit/slim","slug":"not-found","errorCode":null,"errorMessage":"not found","messagePattern":"not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/docker/dockerutil/dockerutil.go","lineNumber":25,"sourceCode":"\t\"errors\"\n\t\"fmt\"\n\t\"io\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/docker/docker/pkg/archive\"\n\tdockerapi \"github.com/fsouza/go-dockerclient\"\n\tlog \"github.com/sirupsen/logrus\"\n\n\t\"github.com/slimtoolkit/slim/pkg/docker/dockerclient\"\n\t\"github.com/slimtoolkit/slim/pkg/util/fsutil\"\n)\n\nvar (\n\tErrBadParam = errors.New(\"bad parameter\")\n\tErrNotFound = errors.New(\"not found\")\n)\n\nconst (\n\tvolumeMountPat       = \"%s:/data\"\n\tvolumeBasePath       = \"/data\"\n\temptyImageName       = \"docker-slim-empty-image:latest\"\n\temptyImageDockerfile = \"FROM scratch\\nCMD\\n\"\n)\n\ntype BasicImageProps struct {\n\tID      string\n\tSize    int64\n\tCreated int64\n}\n\ntype ImageIdentity struct {\n\tID           string\n\tShortTags    []string","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/slimtoolkit/slim/blob/81940d17fa112cc678e32209214bcb2355cb3004/pkg/docker/dockerutil/dockerutil.go#L7-L43","documentation":"ErrNotFound is a sentinel error from dockerutil indicating the requested Docker resource does not exist. It is returned by DoArchiveState, NoImage, HasImage, HasVolume, and WithDefaultConfigPath when the referenced image, volume, file, or default config path cannot be located. Unlike ErrBadParam it means the input was valid but the target is absent.","triggerScenarios":"HasImage/NoImage with an image name not present locally; HasVolume for a nonexistent volume; DoArchiveState on a missing path in a container; WithDefaultConfigPath when the default config directory does not exist.","commonSituations":"Image built under a different tag than the one referenced; volume removed between runs or on a different Docker host; running inside a container where default config paths are not mounted; typo'd image name or registry prefix.","solutions":["Run 'docker images' / 'docker volume ls' to confirm the referenced image or volume exists.","Pull or build the image (or create the volume) before invoking the function.","Verify the exact name:tag including registry prefix matches what Docker reports.","For WithDefaultConfigPath, create the config directory or point the tool at an explicit path."],"exampleFix":"// before\nif err := dockerutil.HasVolume(ctx, client, \"myvol\"); err != nil { ... } // volume missing\n// after\nif _, err := client.CreateVolume(docker.CreateVolumeOptions{Name: \"myvol\"}); err != nil && err.Error() != \"volume exists\" {\n    return err\n}\nexists, err := dockerutil.HasVolume(ctx, client, \"myvol\")","handlingStrategy":"try-catch","validationCode":"images, _ := client.ListImages(docker.ListImagesOptions{All: true})\nfound := false\nfor _, img := range images {\n    for _, tag := range img.RepoTags {\n        if tag == imageName { found = true }\n    }\n}\nif !found { /* pull or build first */ }","typeGuard":null,"tryCatchPattern":"exists, err := dockerutil.HasImage(ctx, client, imageName)\nswitch {\ncase errors.Is(err, dockerutil.ErrNotFound):\n    // auto-pull or report 'image not found: <name>'\ncase err != nil:\n    return err\n}","preventionTips":["Check docker images / docker volume ls before referencing a resource.","Use fully qualified name:tag including registry prefix.","Create volumes/config paths during environment setup scripts.","Distinguish ErrNotFound from ErrBadParam in error handling."],"tags":["docker","not-found","resources"],"backgroundTag":"resource-not-found","analyzedSha":"81940d17fa112cc678e32209214bcb2355cb3004","analyzedAt":"2026-08-31T23:06:12.682Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}