Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.
This repository was archived by the owner on Aug 12, 2025. It is now read-only.

API commentThreads (insert) is not working on client, but works from official code samples #294

@CayoM

Description

@CayoM

Hi,

no matter what i do, im not able to use the commentThreads API for inserting a new comment on a Video... im always getting this error

An HTTP error 400 occurred:
b'{\n  "error": {\n    "code": 400,\n    "message": "The API server failed to successfully process the request. While this can be a transient error, it usually indicates that the request\'s input is invalid. Check the structure of the \\u003ccode\\u003ecommentThread\\u003c/code\\u003e resource in the request body to ensure that it is valid.",\n    "errors": [\n      {\n        "message": "The API server failed to successfully process the request. While this can be a 
transient error, it usually indicates that the request\'s input is invalid. Check the structure of the \\u003ccode\\u003ecommentThread\\u003c/code\\u003e resource in the request body to ensure that it is valid.",\n        "domain": "youtube.commentThread",\n        "reason": "processingFailure",\n        "location": "body",\n        "locationType": "other"\n      }\n    ]\n  }\n}\n'

The code used was in python and here is a snippet:

def comment_on_video(youtube, video_id, text):
    try:
        request = youtube.commentThreads().insert(
            part="snippet",
            body={
                "snippet": {
                    "videoId": video_id,
                    "topLevelComment": {
                        "snippet": {
                            "textOriginal": text
                        }
                    }
                }
            }
        )
        comment = request.execute()
        return comment
    except (HttpError) as e:
        print (f"An HTTP error {e.resp.status} occurred:\n{e.content}")

using this same body into https://developers.google.com/youtube/v3/code_samples/code_snippets i get a 200 response.

This makes me think that at least there are no issues with the account or quotas, since every other APIs are working from my client and this one specifically still works but from google code_snippets to try it out.

i have no clue what is happening... if it was a transient error as stated in the error message, i wouldn't be able to call it from google developers code samples.

Can someone please provide help?

Many thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions