#34243 [Bug]: /v1/messages/count_tokens returns 500 on provider-counter errors instead of falling back to local tokenizer
### Check for existing issues
I searched the existing issues; this is not a duplicate. The closest is the now-closed #28084 (a missing `vertexai` import), which is a different root cause — the problem described here persists with the dependency installed.
### What happened?
`POST /v1/messages/count_tokens` returns **HTTP 500** when a provider-specific token counter *raises* an exception, instead of falling back to the local tokenizer.
The provider dispatch in `_try_provider_token_count` (`litellm/proxy/proxy_server.py`) only handles two failure modes gracefully:
- `httpx.HTTPStatusError` → re-raised as a `ProxyException`. - the returned `result.error is True` → warning + fall back to the local tokenizer (unless `disable_token_counter` is set).
Any **other** exception raised by `provider_counter.count_tokens()` is not caught, so it propagates out of the `count_tokens` endpoint handler and becomes a 500.
The Vertex AI partner-models token counter (`litellm/llms/vertex_ai/common_utils.py` → `vertex_ai_partner_models`) raises a raw exception on failure (e.g. `litellm.Timeout`, or an ADC/credentials error when credentials are absent), which hits this uncaught path.
By contrast, …