Hello,
We are currently trying to develop using the Vertex Live API.
When using an official method to send and receive audio we’re getting hit with the following error:
websockets.exceptions.ConnectionClosedError: received 1008 (policy violation) Publisher Model projects/REDACTED/locations/us-central1/publishers/google/models/gemini-live-2.5-flash ; then sent 1008 (policy violation) Publisher Model projects/REDACTED/locations/us-central1/publishers/google/models/gemini-live-2.5-flash
What we have done so far:
- Created a cloud project and service account
- Connected account to a billing account
- Applied and got accepted to Google’s Developer Preview Program for that project
- Tried switching to different models such as:
– gemini-2.5-flash-preview-native-audio-dialog
– gemini-2.5-flash-exp-native-audio-thinking-dialog
Nothing seems to work as it is supposed to. The API calls show up in the cloud console but again no real information as to what is happening and why.
Has anyone encountered similar issues and is able to provide a working solution for this?
Thanks
1 Like
Hi Felix,
The 1008 (policy violation) error often happens when the audio format or request setup doesn’t match the model’s requirements.
1 Like
Thank you for the answer.
Unfortunately the websocket connection is indeed dropped before I am able to send anything. This is the code im trying this with:
The client is created correctly using vertexai, project and location.
I’ve also double checked if my sample.wav is in the correct format. It is 16Khz Mono, 16Bit-PCM. But as I’ve said, it is not even sent because the connection is dropped before.
EDIT:
Vertex AI API is also enabled for the project.
Also when using
gemini-2.5-flash-preview-native-audio-dialog
The error message is like this:
websockets.exceptions.ConnectionClosedError: received 1008 (policy violation) Publisher Model projects/REDACTED/locations/us-central1/publishers/google/models/gemini-2.5-flash-previe; then sent 1008 (policy violation) Publisher Model projects/REDACTED/locations/us-central1/publishers/google/models/gemini-2.5-flash-previe
The name of the model is cut short. Is that something to note?
Use model gemini-2.0-flash-live-preview-04-09 for 1007 and there is credential issue for 1008 error try it with credentials having full access. Set in environment variable then try it with credentials having full access.
Hi @Felix_Bischoff,
You’re encountering a websockets.exceptions.ConnectionClosedError: received 1008 (policy violation) error with the Vertex Live API. This typically indicates a policy violation, often caused by mismatched audio formats or incorrect request settings.
A “policy violation” typically indicates that some part of your request most often the audio data doesn’t align with the model’s strict requirements. Pay close attention to making sure your audio is precisely formatted.
Here’s what you can try to resolve the issue:
-
Audio Format Matters Most: The Vertex Live API expects raw 16-bit PCM audio at 16kHz (input) or 24kHz (output), little-endian, mono. Carefully inspect your audio files to ensure they strictly adhere to these specifications. Even minor mismatches can lead to connection errors.
-
Validate Request Configuration: Ensure your request configuration is correct by using the full and accurate model path (e.g., projects/YOUR_PROJECT_ID/…/gemini-live-2.5-flash) and carefully reviewing all parameters in your API call, with particular attention to those related to audio input and output.
-
Developer Preview & Permissions: Verify that your project is correctly enrolled in the Developer Preview, the Vertex AI API is enabled, and your service account has the appropriate permissions (such as the Vertex AI User role) to access the service.
-
Troubleshooting and Support Guidance: Enable detailed logging in your client libraries (such as websockets and google-genai) to help identify issues. Check Google Cloud Logging for more in-depth error messages related to your API calls.
If the issue persists, contact Google Cloud Support. When reaching out, include detailed information and relevant screenshots of the errors you’ve encountered. This will assist them in diagnosing and resolving your issue more efficiently.