Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker::Error::ServerError: error parsing HTTP 400 response body: unexpected end of JSON input: "" #2611

Open
matti opened this issue Jul 24, 2017 · 6 comments

Comments

@matti
Copy link
Contributor

matti commented Jul 24, 2017

deployed 2 instances of the stack successfully, then on the third stack install + deploy:

TIME                      TYPE                      MESSAGE
2017-07-24T12:37:58.875Z  service:create_instance   pulling image registry.example.com/mystack/daemon:latest for mystack/daemon-1 (node-1)
2017-07-24T12:38:03.166Z  service:create_instance   unexpected error while creating mystack/daemon-1: error parsing HTTP 400 response body: unexpected end of JSON input: ""
 (node-1)
Deployment of service mygrid/mystack/daemon failed:
  - halting deploy of mygrid/mystack/daemon, one or more instances failed
  - GridServiceInstanceDeployer::ServiceError: Docker::Error::ServerError: error parsing HTTP 400 response body: unexpected end of JSON input: "" (on node node-1)
$ cat /etc/lsb-release
DISTRIB_ID="Container Linux by CoreOS"
DISTRIB_RELEASE=1409.7.0
DISTRIB_CODENAME="Ladybug"
DISTRIB_DESCRIPTION="Container Linux by CoreOS 1409.7.0 (Ladybug)"
$ docker -v
Docker version 1.12.6, build a82d35e
@SpComb
Copy link
Contributor

SpComb commented Jul 24, 2017

Anything interesting in journalctl -u docker.service from the same time?

Sounds like a Docker daemon error.

@matti
Copy link
Contributor Author

matti commented Jul 24, 2017

okay, resolved: repository didn't exist:

Jul 24 13:33:08 node-1 dockerd[992]: time="2017-07-24T13:33:08.766932539Z" level=error msg="Error trying v2 registry: error parsing HTTP 400 response body: unexpected end of JSON input: \"\""
Jul 24 13:33:08 node-1 dockerd[992]: time="2017-07-24T13:33:08.767477407Z" level=error msg="Attempting next endpoint for pull after error: error parsing HTTP 400 response body: unexpected end of JSON input: \"\""
Jul 24 13:33:08 node-1 dockerd[992]: time="2017-07-24T13:33:08.767703295Z" level=error msg="Handler for POST /v1.22/images/create returned error: error parsing HTTP 400 response body: unexpected end of JSON input: \"\""
Jul 24 13:33:09 node-1 dockerd[992]: time="2017-07-24T13:33:09.299070832Z" level=error msg="Error trying v2 registry: error parsing HTTP 400 response body: unexpected end of JSON input: \"\""
Jul 24 13:33:09 node-1 dockerd[992]: time="2017-07-24T13:33:09.299614815Z" level=error msg="Attempting next endpoint for pull after error: error parsing HTTP 400 response body: unexpected end of JSON input: \"\""
Jul 24 13:33:09 node-1 dockerd[992]: time="2017-07-24T13:33:09.299868935Z" level=error msg="Handler for POST /v1.22/images/create returned error: error parsing HTTP 400 response body: unexpected end of JSON input: \"\""
Jul 24 13:33:09 node-1 dockerd[992]: time="2017-07-24T13:33:09.804902465Z" level=error msg="Error trying v2 registry: error parsing HTTP 400 response body: unexpected end of JSON input: \"\""
Jul 24 13:33:09 node-1 dockerd[992]: time="2017-07-24T13:33:09.805444988Z" level=error msg="Attempting next endpoint for pull after error: error parsing HTTP 400 response body: unexpected end of JSON input: \"\""
Jul 24 13:33:09 node-1 dockerd[992]: time="2017-07-24T13:33:09.805663823Z" level=error msg="Handler for POST /v1.22/images/create returned error: error parsing HTTP 400 response body: unexpected end of JSON input: \"\""

Should this issue be closed or should the error handling be improved?

@SpComb
Copy link
Contributor

SpComb commented Jul 24, 2017

Based on those logs, it looks like the Docker::Image.create may have failed with raise Docker::Error::ServerError, 'error parsing HTTP 400 response body: unexpected end of JSON input: ""'. It looks like this isn't the agent docker API client getting an unexpected EOF from the local Docker daemon, but the Docker daemon getting a HTTP 400 response + unexpected EOF from the external image registry?

IOW: whatever registry you're pulling from seems to be broken?

The agent could perhaps give some better error with more context, like Docker server error while pulling image foo.io/bar: error parsing HTTP 400 response body: unexpected end of JSON input: ""'

@matti
Copy link
Contributor Author

matti commented Jul 24, 2017

yep. Heroku's container registry apparently returns "" if image not found

@andreatulimiero
Copy link

IMHO the error should be clarified since a response code "400" is truly misleading

@blairg
Copy link

blairg commented Jan 19, 2019

I had a similar issue with the 400 response. This is what helped us https://hackerlite.xyz/heroku-docker-deployments/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants