Exercism submit | 400 Bad Request

,

Hello together,

When I try to submit my solution, I get the following errors on two different Debian 12 clients:

-----------------------------------------------------------
**xxx@box:~/exercism/rust/reverse-string$** exercism submit

Error: expected response with Content-Type "application/json" but got status "400 Bad Request" with Content-Type "application/json; charset=utf-8"
-----------------------------------------------------------

According to the forum search, the problem only affects me.

Does anyone have any hints for me on what I am doing wrong or need to do to make it work?

Troubleshooting Information
===========================

Version
----------------
Current: 3.5.6
Latest:  3.5.6


Operating System
----------------
OS:           linux
Architecture: amd64


Configuration
----------------
Home:      /home/xxx
Workspace: /home/xxx/exercism
Config:    /home/xxx/.config/exercism
API key:   1f9c*****************************283

API Reachability
----------------

GitHub:
    * https://api.github.com
    * [connected]
    * 11.22704ms

Exercism:
    * https://api.exercism.org/v1/ping
    * [connected]
    * 195.089417ms
-----------------------------------------------------------

@IsaacG in your CLI change (dunno if relevant!) did you account for content-type header including key-value parameters such as charset? I skimmed over it and thought you did an inclusion check, so it should be fine, but may be worth to double-check.

@miromoto can you give use the output of ls -ln1? The error says the request is not in a correct format (we can’t see what exactly is wrong because the error message is not expanded), but we may be able to deduce it by figuring out what it’s trying to submit.

By giving us the directory contents (ls), we can compare it with the rust track’s configuration for the reverse-string exercise and see what the CLI is supposed to submit.

@SleeplessByte
Thank you for your support.

xxx@box:~/exercism/rust/reverse-string$ ls -ln1
total 28
-rw-r--r-- 1 1000 1000  158 Jul 14 12:28 Cargo.lock
-rw-r--r-- 1 1000 1000  318 Jul 14 12:28 Cargo.toml
-rw-r--r-- 1 1000 1000 2963 Jul 14 12:28 HELP.md
-rw-r--r-- 1 1000 1000 2030 Jul 14 12:28 README.md
drwxr-xr-x 2 1000 1000 4096 Jul 14 12:28 src
drwxr-xr-x 4 1000 1000 4096 Jul 14 12:28 target
drwxr-xr-x 2 1000 1000 4096 Jul 14 12:28 tests
xxx@box:~/exercism/rust/reverse-string$ tree
.
β”œβ”€β”€ Cargo.lock
β”œβ”€β”€ Cargo.toml
β”œβ”€β”€ HELP.md
β”œβ”€β”€ README.md
β”œβ”€β”€ src
β”‚   └── lib.rs
β”œβ”€β”€ target
β”‚   β”œβ”€β”€ CACHEDIR.TAG
β”‚   β”œβ”€β”€ debug
β”‚   β”‚   β”œβ”€β”€ build
β”‚   β”‚   β”œβ”€β”€ deps
β”‚   β”‚   β”‚   β”œβ”€β”€ libreverse_string-84f6f1c563e0e99a.rlib
β”‚   β”‚   β”‚   β”œβ”€β”€ libreverse_string-84f6f1c563e0e99a.rmeta
β”‚   β”‚   β”‚   β”œβ”€β”€ reverse_string-315f5027a71c99ed
β”‚   β”‚   β”‚   β”œβ”€β”€ reverse_string-315f5027a71c99ed.d
β”‚   β”‚   β”‚   β”œβ”€β”€ reverse_string-84f6f1c563e0e99a.d
β”‚   β”‚   β”‚   β”œβ”€β”€ reverse_string-ada544ccfc9e516a
β”‚   β”‚   β”‚   └── reverse_string-ada544ccfc9e516a.d
β”‚   β”‚   β”œβ”€β”€ examples
β”‚   β”‚   └── incremental
β”‚   β”‚       β”œβ”€β”€ ...
β”‚   └── tmp
└── tests
    └── reverse_string.rs
xxx@box:~/exercism/rust/reverse-string/.exercism$ ls -lash
total 16K
4.0K drwxr-xr-x 2 toni toni 4.0K Jul 14 12:28 .
4.0K drwxr-xr-x 6 toni toni 4.0K Jul 14 12:28 ..
4.0K -rw-r--r-- 1 toni toni  726 Jul 14 12:28 config.json
4.0K -rw------- 1 toni toni  211 Jul 14 12:28 metadata.json

Thank you!

This looks like it matches the config.json.

For funsies, could you attempt to manually submit the files:

exercism submit src/lib.rs Cargo.toml

Apparently not.

    // jsonContentTypeRe is used to match Content-Type which contains JSON.
    jsonContentTypeRe = regexp.MustCompile(`^application/([[:alpha:]]+\+)?json$`)

I suppose that regex should end with ($|;) ?

1 Like

Yes, technically charset (and other kvs) do not need be present, but then there is no semicolon.

For your reviewing.

2 Likes

I tried with

exercism submit src/lib.rs Cargo.toml

and get the same error

1 Like

The CLI was … just updated now :slight_smile:

If you try with a newer version, you should get a more helpful error message.

Thank you and SleeplessByte for the kindly and quick support.

I delete the /usr/local/bin/exercism executable and download the current release 3.5.6.

In addition I download the excercise again via cli api.

But I get the same error message.

How I can use the newer, fixed, version?

2 Likes

You want 3.5.7.

…which didn’t exist an hour ago :slight_smile:

New release created (3.5.7) with said fix. Thank you @kotp for flagging the need for a release!

1 Like

Does the release process touch homebrew?

$ brew update
...
$ brew info exercism
==> exercism: stable 3.5.6 (bottled), HEAD
...
1 Like

The formula was updated to 3.5.6 just last week in exercism 3.5.6 by BrewTestBot Β· Pull Request #229186 Β· Homebrew/homebrew-core Β· GitHub. Somebody seems to have run brew bump which in turn triggered the PR by the bot. Looking at some other PRs, it seems GitHub - mislav/bump-homebrew-formula-action: Automatically bump Homebrew formula after a release might be useful for us in deploying future updates to Homebrew.

1 Like

Now is all working, thank you all for the great and quick support!

1 Like

Thank you all! :slight_smile: