Digging deeper, this is actually an old issue we have not had time to address:
https://github.com/killbill/killbill/issues/902
I would say if the call does not return 200, then it means the tenant does not exist -- in reality you could have a real 500 error, i.e your DB is down and Kill Bill fails to access it -- but in practise call very rarely return 500. If you want to improve on the workaround you could use the json returned in the error:
< HTTP/1.1 500 Internal Server Error
< Date: Wed, 28 Apr 2021 00:09:48 GMT
< Set-Cookie: rememberMe=deleteMe; Path=/; Max-Age=0; Expires=Tue, 27-Apr-2021 00:09:48 GMT
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Methods: GET, POST, DELETE, PUT, OPTIONS
< Access-Control-Allow-Headers: Authorization,Content-Type,Location,X-Killbill-ApiKey,X-Killbill-ApiSecret,X-Killbill-Comment,X-Killbill-CreatedBy,X-Killbill-Pagination-CurrentOffset,X-Killbill-Pagination-MaxNbRecords,X-Killbill-Pagination-NextOffset,X-Killbill-Pagination-NextPageUri,X-Killbill-Pagination-TotalNbRecords,X-Killbill-Reason
< Access-Control-Expose-Headers: Authorization,Content-Type,Location,X-Killbill-ApiKey,X-Killbill-ApiSecret,X-Killbill-Comment,X-Killbill-CreatedBy,X-Killbill-Pagination-CurrentOffset,X-Killbill-Pagination-MaxNbRecords,X-Killbill-Pagination-NextOffset,X-Killbill-Pagination-NextPageUri,X-Killbill-Pagination-TotalNbRecords,X-Killbill-Reason
< Access-Control-Allow-Credentials: true
< Content-Type: application/json
< Vary: Accept-Encoding
< Content-Length: 285
< Server: Jetty(9.4.36.v20210114)
<
* Connection #0 to host 127.0.0.1 left intact
{"className":"java.lang.RuntimeException","code":null,"message":"java.lang.IllegalStateException: TenantCacheLoader cannot find value for key 123455","causeClassName":"java.lang.IllegalStateException","causeMessage":"TenantCacheLoader cannot find value for key 123455","stackTrace":[]}* Closing connection 0