imogen trash <id> <id> … is rejected with a 400; the same ids trashed one at a time all
succeed.
$ imogen trash 99588211-… 9f3e624a-… 4784a6ba-… (11 ids)
error: The request did not match what this endpoint expects (400 validation_failed)
$ imogen trash --json 99588211-…
{ "count": 1 }
Eleven separate calls trashed all eleven. Only the multi-id form fails.
Where it is going wrong
AssetSelection in @imogen/shared refuses a body carrying both selectors:
if ((selection.assetIds === undefined) === (selection.query === undefined)) {
return 'Provide exactly one of assetIds or query'
}
and the comment above it says this is meant to be caught client-side:
a client should learn this before the request leaves, not from a 400: every port checks
the same two rules, and the SDK's own selection helper checks them with this.
So the CLI is sending query alongside assetIds — presumably its filter options
(--type, --album, --favorite, --archived, -Q) building a query object even when
none were given and ids were. That the single-id call succeeds suggests the difference is in
how the argument list is turned into a selection, not in the ids themselves.
Whatever the mechanism, the rule was supposed to be enforced before the request left and was
not — the server's 400 is the first anyone hears of it.
Worth checking while in there
The 400 tells the user nothing. The server returns a details map naming the offending
field, and the message here is the generic envelope sentence — the same gap that made
ergofobe/imogen-android#22 undiagnosable until the client started recording details.
Surfacing it would have made this a ten-second diagnosis instead of a server-log hunt.
Environment
imogen 0.1.2 against imogen-server 0.5.1. Reproduced with 11 valid uuids belonging to
the caller.
Bar
cargo test --locked && cargo fmt --check && cargo clippy --all-targets --locked -- -D warnings && cargo build --release --locked. A test that a multi-id selection serialises to assetIds
only, with no query key, is the one that would have caught this.
imogen trash <id> <id> …is rejected with a 400; the same ids trashed one at a time allsucceed.
Eleven separate calls trashed all eleven. Only the multi-id form fails.
Where it is going wrong
AssetSelectionin@imogen/sharedrefuses a body carrying both selectors:and the comment above it says this is meant to be caught client-side:
So the CLI is sending
queryalongsideassetIds— presumably its filter options(
--type,--album,--favorite,--archived,-Q) building a query object even whennone were given and ids were. That the single-id call succeeds suggests the difference is in
how the argument list is turned into a selection, not in the ids themselves.
Whatever the mechanism, the rule was supposed to be enforced before the request left and was
not — the server's 400 is the first anyone hears of it.
Worth checking while in there
The 400 tells the user nothing. The server returns a
detailsmap naming the offendingfield, and the message here is the generic envelope sentence — the same gap that made
ergofobe/imogen-android#22 undiagnosable until the client started recording
details.Surfacing it would have made this a ten-second diagnosis instead of a server-log hunt.
Environment
imogen 0.1.2againstimogen-server0.5.1. Reproduced with 11 valid uuids belonging tothe caller.
Bar
cargo test --locked && cargo fmt --check && cargo clippy --all-targets --locked -- -D warnings && cargo build --release --locked. A test that a multi-id selection serialises toassetIdsonly, with no
querykey, is the one that would have caught this.