Failed to start application 'registry2-resin-io/XXXXX/XXXXXXXX' due to '(HTTP code 500) server error

I’m trying to install my first project with Resin. I get everything set up, device provisioned, etc. and I push my code. This shows up in my logs, and my project doesn’t run. (periods have been replaced with dashes because I can’t have more than 2 links)

10.02.18 22:01:46 (-0800) Installing application 'registry2-resin-io/XXXXX/XXXXXXXX'
10.02.18 22:02:04 (-0800) Installed application 'registry2-resin-io/XXXXX/XXXXXXXX'
10.02.18 22:02:04 (-0800) Starting application 'registry2-resin-io/XXXXX/XXXXXXXX'
10.02.18 22:02:12 (-0800) Failed to start application 'registry2-resin-io/XXXXX/XXXXXXXX' due to '(HTTP code 500) server error - invalid character 'c' looking for beginning of value '
10.02.18 22:02:12 (-0800) Failed to update application 'registry2-resin-io/XXXXX/XXXXXXXX' due to '(HTTP code 500) server error - invalid character 'c' looking for beginning of value '
10.02.18 22:02:13 (-0800) Killing application 'registry2-resin-io/XXXXX/XXXXXXXX'
10.02.18 22:02:13 (-0800) Application is already stopped and the container removed 'registry2-resin-io/XXXXX/XXXXXXXX'
10.02.18 22:02:13 (-0800) Killed application 'registry2-resin-io/XXXXX/XXXXXXXX'

Any ideas? Nothing in my code throws errors like this.
Code is located here.

This sort of problem can happen when, for whatever reason, the container becomes corrupted. We’ve got a fix recorded in our play book, and all we need to run this is the link to the device and for you to grant support access.

I figured out the problem, and I felt like an idiot when I fixed it. I had my dockerfile set up to build in two stages, and my second stage was from scratch. I fixed that to the resin Alpine image, and it runs fine.