{"record":{"id":"703be55ed2a9f401","repo":"slimtoolkit/slim","slug":"missing-startup-info","errorCode":null,"errorMessage":"missing startup info","messagePattern":"missing startup info","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/imagebuilder/internalbuilder/engine.go","lineNumber":54,"sourceCode":"// New creates new Engine instances\nfunc New(\n\tshowBuildLogs bool,\n\tpushToDaemon bool,\n\tpushToRegistry bool) (*Engine, error) {\n\n\tengine := &Engine{\n\t\tShowBuildLogs:  showBuildLogs,\n\t\tPushToDaemon:   pushToDaemon,\n\t\tPushToRegistry: pushToRegistry,\n\t}\n\n\treturn engine, nil\n}\n\nfunc (ref *Engine) Build(options imagebuilder.SimpleBuildOptions) (*imagebuilder.ImageResult, error) {\n\tif len(options.ImageConfig.Config.Entrypoint) == 0 &&\n\t\tlen(options.ImageConfig.Config.Cmd) == 0 {\n\t\treturn nil, fmt.Errorf(\"missing startup info\")\n\t}\n\n\tif len(options.Layers) == 0 {\n\t\treturn nil, fmt.Errorf(\"no layers\")\n\t}\n\n\tif len(options.Layers) > 255 {\n\t\treturn nil, fmt.Errorf(\"too many layers\")\n\t}\n\n\tswitch options.ImageConfig.Architecture {\n\tcase \"\":\n\t\toptions.ImageConfig.Architecture = \"amd64\"\n\tcase \"arm64\", \"amd64\":\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"bad architecture value\")\n\t}\n","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/slimtoolkit/slim/blob/81940d17fa112cc678e32209214bcb2355cb3004/pkg/imagebuilder/internalbuilder/engine.go#L36-L72","documentation":"The internal builder's Engine.Build produces an image whose process can actually start. If the provided image config defines neither an ENTRYPOINT nor a CMD, there is no startup command and Build refuses with 'missing startup info'. The library will not invent a default command for the image.","triggerScenarios":"Calling engine.Build with imagebuilder.SimpleBuildOptions whose ImageConfig.Config.Entrypoint and Cmd are both empty arrays — e.g. building from a Dockerfile that only has FROM/ENV lines, or constructing the config manually without setting either field.","commonSituations":"Parsing a base-image-only Dockerfile through SimpleBuildOptionsFromDockerfileData; hand-assembled image configs for batch/init images where the author forgot CMD; Dockerfiles relying on a parent image's ENTRYPOINT without restating it.","solutions":["Set Config.Cmd in SimpleBuildOptions.ImageConfig to the desired default command, e.g. [\"/app/server\"].","Set Config.Entrypoint instead if the image should behave as an executable wrapper.","If the image is intentionally non-runnable (a data/base image), use a different builder path or add a trivial CMD like [\"true\"]."],"exampleFix":"// before\nopts := imagebuilder.SimpleBuildOptions{Layers: layers}\nres, err := engine.Build(opts) // missing startup info\n// after\nopts := imagebuilder.SimpleBuildOptions{Layers: layers}\nopts.ImageConfig.Config.Cmd = []string{\"/app/run\"}\nres, err := engine.Build(opts)","handlingStrategy":"validation","validationCode":"func hasStartupInfo(cfg imagebuilder.SimpleBuildOptions) bool {\n\tc := cfg.ImageConfig.Config\n\treturn len(c.Entrypoint) > 0 || len(c.Cmd) > 0\n}\n\nif !hasStartupInfo(opts) {\n\topts.ImageConfig.Config.Cmd = []string{\"/app/run\"}\n}\nres, err := engine.Build(opts)","typeGuard":"func isRunnable(config imagebuilder.Config) bool {\n\treturn len(config.Entrypoint) > 0 || len(config.Cmd) > 0\n}","tryCatchPattern":"res, err := engine.Build(opts)\nif err != nil {\n\tif strings.Contains(err.Error(), \"missing startup info\") {\n\t\topts.ImageConfig.Config.Cmd = []string{\"/bin/true\"}\n\t\treturn engine.Build(opts)\n\t}\n\treturn nil, err\n}","preventionTips":["Always set Cmd or Entrypoint when constructing ImageConfig programmatically","Restate ENTRYPOINT/CMD explicitly instead of relying on the base image","Validate image configs with a shared helper before Build","When extracting config from Dockerfiles, ensure ENTRYPOINT/CMD lines are preserved"],"tags":["docker","image-builder","image-config","validation"],"backgroundTag":"missing-image-startup-command","analyzedSha":"81940d17fa112cc678e32209214bcb2355cb3004","analyzedAt":"2026-08-31T23:06:12.682Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}