{"id":"a551431579c251f3","repo":"docker/cli","slug":"exec-id-empty","errorCode":null,"errorMessage":"exec ID empty","messagePattern":"exec ID empty","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/container/exec.go","lineNumber":118,"sourceCode":"\tif _, err := apiClient.ContainerInspect(ctx, containerIDorName, client.ContainerInspectOptions{}); err != nil {\n\t\treturn err\n\t}\n\tif !options.Detach {\n\t\tif err := dockerCLI.In().CheckTty(execOptions.AttachStdin, execOptions.TTY); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tfillConsoleSize(execOptions, dockerCLI)\n\n\tresponse, err := apiClient.ExecCreate(ctx, containerIDorName, *execOptions)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\texecID := response.ID\n\tif execID == \"\" {\n\t\treturn errors.New(\"exec ID empty\")\n\t}\n\n\tif options.Detach {\n\t\t_, err := apiClient.ExecStart(ctx, execID, client.ExecStartOptions{\n\t\t\tDetach:      options.Detach,\n\t\t\tTTY:         execOptions.TTY,\n\t\t\tConsoleSize: client.ConsoleSize{Height: execOptions.ConsoleSize.Height, Width: execOptions.ConsoleSize.Width},\n\t\t})\n\t\treturn err\n\t}\n\treturn interactiveExec(ctx, dockerCLI, execOptions, execID)\n}\n\nfunc fillConsoleSize(execOptions *client.ExecCreateOptions, dockerCli command.Cli) {\n\tif execOptions.TTY {\n\t\theight, width := dockerCli.Out().GetTtySize()\n\t\texecOptions.ConsoleSize = client.ConsoleSize{Height: height, Width: width}\n\t}","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/container/exec.go#L100-L136","documentation":"After `docker exec` calls the ExecCreate API, the daemon returns an exec instance ID that the CLI needs for the subsequent ExecStart call. If the response's ID field is empty, the CLI aborts with this error — it indicates a malformed or unexpected daemon response rather than a user mistake, since ExecCreate succeeded (no transport error) yet returned no usable ID.","triggerScenarios":"apiClient.ExecCreate succeeds but response.ID == \"\" — a daemon or proxy returning an empty/stripped JSON body, an API-version mismatch, or a non-Docker endpoint impersonating the Docker API.","commonSituations":"Buggy or incompatible Docker API proxies/socket gateways (e.g. socket-proxy setups that mangle responses); talking to a very old or non-conformant daemon implementation; middleware that rewrites API responses.","solutions":["Check what the CLI is actually talking to: `docker version` and `echo $DOCKER_HOST` / `docker context ls` — bypass any proxy and connect to the daemon directly.","Upgrade or fix the daemon/proxy so ExecCreate returns a valid Id field.","Retry the exec after restarting the daemon if it is in a bad state; inspect daemon logs for the exec create request."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["docker-cli","docker-exec","api-response","daemon"],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}