Troubleshoot: StashDB & Whisparr V3 Integration Errors
Are you experiencing issues integrating StashDB with Whisparr v3, where you can only view existing items but can't add new scenes? Getting a dreaded "Error 400: Bad Request" message? You're not alone! This article dives into the common causes of this problem and provides practical solutions to get your setup working smoothly. We'll explore the error messages, possible configuration issues, and troubleshooting steps to resolve this frustrating integration snag.
Understanding the Problem: StashDB and Whisparr v3 Integration Woes
So, you've got the latest versions of StashDB and Whisparr v3 all set up, but when you try to add a scene from StashDB to Whisparr, you hit a wall. Instead of the seamless integration you were hoping for, you're greeted with an error message. This usually manifests as a "400 Bad Request" error, indicating that the request sent from StashDB to Whisparr isn't being understood or accepted. This can be super frustrating, especially when you're trying to organize your media library. Let's break down why this might be happening.
Decoding the Error Messages
Let's dissect those error messages to understand what they're telling us. The key part is the "400 Bad Request" status. This is a general HTTP error that means the server (in this case, Whisparr) couldn't process the request due to something wrong on the client-side (StashDB, or more specifically, the Stasharr userscript). The error messages you provided contain valuable clues. The readyState: 4 indicates the request was completed, but the status: 400 confirms the error. The statusText: 'Bad Request' is the server's concise explanation. The longer error message, GM.xmlHttpRequest error: Error: HTML Response error: 400: Bad Request, points to an issue with the userscript's attempt to communicate with the Whisparr API. These errors often stem from incorrect API endpoints, malformed data being sent, or authentication problems.
Common Culprits Behind the "Bad Request"
Several factors can contribute to this error. Here are some of the most common:
- Incorrect Whisparr API URL: Double-check that the URL configured in the Stasharr userscript is correct and points to your Whisparr instance. A simple typo can cause this error.
- API Key Issues: Whisparr uses API keys for authentication. Ensure the API key configured in Stasharr is valid and has the necessary permissions to add movies.
- Data Formatting Problems: The data Stasharr sends to Whisparr might be in an unexpected format. This could be due to changes in the Whisparr API or issues with the userscript itself.
- CORS (Cross-Origin Resource Sharing) Issues: If StashDB and Whisparr are running on different domains or ports, CORS restrictions might be preventing the userscript from making requests. This is less likely if they are on the same local network but still worth considering.
- Whisparr Version Incompatibilities: While you're using v3, there might be subtle differences between versions that affect the API. Ensure Stasharr is compatible with your specific Whisparr v3 version.
- Firewall or Network Issues: A firewall or network configuration might be blocking communication between StashDB and Whisparr.
Troubleshooting Steps: Getting StashDB and Whisparr Talking
Okay, let's get our hands dirty and troubleshoot this thing! Here's a step-by-step approach to diagnose and fix the issue:
1. Verify the Whisparr API URL
This is the most basic but often overlooked step. Carefully check the Whisparr API URL in your Stasharr userscript settings. It should look something like http://192.168.50.219:7070/api/v3. Pay close attention to the port number (7070 in your case) and the /api/v3 endpoint. Make sure there are no typos! A missing slash or an incorrect IP address can break the connection.
2. Check Your Whisparr API Key
In Whisparr, navigate to Settings > General and find the API Key. Copy this key and paste it into the Stasharr userscript settings. Double-check that you've copied the entire key and that there are no extra spaces or characters. An invalid API key will definitely result in a "Bad Request" error. Also, confirm that the API key has the necessary permissions to add movies.
3. Examine the Stasharr Userscript
Ensure you're using the latest version of the Stasharr userscript. Outdated scripts might have compatibility issues with newer versions of Whisparr. You can usually find the latest version on the StashDB or Stasharr GitHub repository. If you've modified the script, review your changes to ensure they haven't introduced any errors.
4. Inspect Browser Console for More Clues
The browser console (usually accessible by pressing F12) can provide more detailed error messages and debugging information. Look for any errors related to the Stasharr userscript or network requests. These messages might give you a more specific idea of what's going wrong. Pay attention to any CORS errors or messages indicating that the API key is invalid.
5. Test the API Endpoint Directly
You can use tools like curl or Postman to send a test request to the Whisparr API endpoint. This helps isolate whether the issue is with Stasharr or with the Whisparr API itself. For example, you could try fetching a list of movies using your API key. If you get a "Bad Request" error here too, the problem is likely with your Whisparr configuration or API key.
6. Review Whisparr Logs
Whisparr logs can provide valuable insights into what's happening on the server-side. Check the logs for any error messages related to the incoming requests from Stasharr. These logs might reveal issues with data validation, authentication, or other server-side problems. The logs are usually located in the Whisparr installation directory.
7. Consider CORS Issues (If Applicable)
If StashDB and Whisparr are running on different domains or ports, you might need to configure CORS in Whisparr to allow requests from StashDB. This usually involves adding the StashDB origin to the Access-Control-Allow-Origin header in the Whisparr response. However, if they're both on the same local network, CORS is less likely to be the issue.
8. Simplify and Isolate
Try adding a very simple scene to Whisparr using Stasharr. This helps determine if the issue is specific to certain scenes or a general problem. Also, temporarily disable any other userscripts or browser extensions that might be interfering with Stasharr.
9. Network Connectivity
Ensure that the machine running StashDB can communicate with the machine running Whisparr. Use ping or traceroute to verify network connectivity between the two machines. A firewall or network configuration might be blocking communication.
10. Whisparr Version Compatibility
Although you're on v3, differences exist between minor versions. Check the Stasharr documentation or community forums for any known compatibility issues with your specific Whisparr v3 version. You might need to update or downgrade Whisparr to resolve the problem.
Example using curl to test the API
To diagnose the connectivity and authentication with your Whisparr instance, you can use curl to directly query the API. Here's how you can test your Whisparr API endpoint using curl from your terminal:
-
List Movies: This command attempts to retrieve a list of movies from your Whisparr library. Replace
YOUR_API_KEYwith your actual Whisparr API key.curl -X GET \ -H "X-Api-Key: YOUR_API_KEY" \ "http://192.168.50.219:7070/api/v3/movie"- If the API key is correct and the endpoint is reachable, you will receive a JSON response containing an array of movie objects.
- If you receive a
401 Unauthorizederror, the API key is likely incorrect or not properly set. - If you receive a
404 Not Founderror, the API endpoint might be incorrect.
Seeking Further Assistance
If you've tried all these steps and you're still banging your head against the wall, don't despair! The StashDB and Whisparr communities are usually very helpful. Post your problem on the StashDB or Whisparr forums, or on relevant Reddit communities. Be sure to include detailed information about your setup, the error messages you're seeing, and the steps you've already taken to troubleshoot the issue. The more information you provide, the easier it will be for others to help you.
By systematically working through these troubleshooting steps, you should be able to identify and resolve the "400 Bad Request" error and get your StashDB and Whisparr v3 integration working seamlessly. Good luck, and happy media organizing!