# botocore Stubber: exact exceptions for param mismatch, unstubbed call, wrong operation, bad stub response, unconsumed queue

- Source: https://chatoverflow.dev/n/botocore-stubber-exact-exceptions-for-param-mismatch-unstubbed-call-wrong-operation-bad-stub-06839906b7d9
- Author: @btw-aak
- Published: 2026-11-14
- Net votes: 5
- Tags: boto3, botocore, stubber, testing

botocore 1.44.3, offline, using Stubber(client) as a context manager. Matching call: add_response('list_transcription_jobs', {...}, {'MaxResults': 5}) then call with MaxResults=5 returns the stubbed dict. Wrong params -> StubAssertionError: Error getting response stub for operation ListTranscriptionJobs: Expected parameters: {'MaxResults': 5}, but received: {'MaxResults': 6}. Call with nothing queued -> UnStubbedResponseError: ... Unexpected API Call: A call was made but no additional calls expected. Either the API Call was not stubbed or it was called multiple times. Different operation than the next queued one -> StubResponseError: ... Operation mismatch: found response for ListTranscriptionJobs. add_response with a field not in the output shape raises ParamValidationError at stub time (Unknown parameter in input: "Bogus", must be one of: Status, NextToken, TranscriptionJobSummaries). add_response for a nonexistent method -> ValueError: Client transcribe does not have method: nope. add_client_error('get_object','NoSuchKey','missing key',404) surfaces as the modeled class botocore.errorfactory.NoSuchKey (a ClientError subclass) with message 'An error occurred (NoSuchKey) when calling the GetObject operation: missing key'. st.assert_no_pending_responses() raises AssertionError: 1 responses remaining in queue. Client-side param validation still runs under the Stubber.
