freeedcom / ai-codereviewer

AI Code Reviewer: Enhance your GitHub workflow with AI-powered code review! Get intelligent feedback and suggestions on pull requests using OpenAI's GPT-4 API, improving code quality and saving developers time.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: RequestError [HttpError]: Unprocessable Entity: "Pull request review thread path is invalid and Pull request review thread diff hunk can't be blank"

zainlks opened this issue · comments

There seems to be an error when submitting the review to github.

Error log:

Error: RequestError [HttpError]: Unprocessable Entity: "Pull request review thread path is invalid and Pull request review thread diff hunk can't be blank"
    at /home/runner/work/_actions/freeedcom/ai-codereviewer/main/webpack:/open-ai-reviewer/node_modules/@octokit/request/dist-node/index.js:7[8](https://github.com/LightConsultingInc/alphaedu-FE/actions/runs/7153530492/job/19480089954#step:3:9):1
    at processTicksAndRejections (node:internal/process/task_queues:[9](https://github.com/LightConsultingInc/alphaedu-FE/actions/runs/7153530492/job/19480089954#step:3:10)6:5) {
  status: 422,
  response: {
    url: 'https://api.github.com/repos/LightConsultingInc/alphaedu-FE/pulls/178/reviews',
    status: 422,
    headers: {
      'access-control-allow-origin': '*',
      'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset',
      connection: 'close',
      'content-length': '246',
      'content-security-policy': "default-src 'none'",
      'content-type': 'application/json; charset=utf-8',
      date: 'Sat, 09 Dec 2023 21:07:06 GMT',
      'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
      server: 'GitHub.com',
      'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
      vary: 'Accept-Encoding, Accept, X-Requested-With',
      'x-accepted-github-permissions': 'pull_requests=write',
      'x-content-type-options': 'nosniff',
      'x-frame-options': 'deny',
      'x-github-api-version-selected': '2022-11-28',
      'x-github-media-type': 'github.v3; format=json',
      'x-github-request-id': '6CE0:9641:32C0EE5:3476A4E:6574D6FA',
      'x-ratelimit-limit': '[10](https://github.com/LightConsultingInc/alphaedu-FE/actions/runs/7153530492/job/19480089954#step:3:11)00',
      'x-ratelimit-remaining': '979',
      'x-ratelimit-reset': '1702158488',
      'x-ratelimit-resource': 'core',
      'x-ratelimit-used': '21',
      'x-xss-protection': '0'
    },
    data: {
      message: 'Unprocessable Entity',
      errors: [Array],
      documentation_url: 'https://docs.github.com/rest/pulls/reviews#create-a-review-for-a-pull-request'
    }
  },
  request: {
    method: 'POST',
    url: 'https://api.github.com/repos/LightConsultingInc/alphaedu-FE/pulls/178/reviews',
    headers: {
      accept: 'application/vnd.github.v3+json',
      'user-agent': 'octokit-rest.js/19.0.7 octokit-core.js/4.2.0 Node.js/[16](https://github.com/LightConsultingInc/alphaedu-FE/actions/runs/7153530492/job/19480089954#step:3:17).[20](https://github.com/LightConsultingInc/alphaedu-FE/actions/runs/7153530492/job/19480089954#step:3:21).2 (linux; x64)',
      authorization: 'token [REDACTED]',
      'content-type': 'application/json; charset=utf-8'
    },
    body: '{"comments":[{"body":"The `permissions: write-all` setting gives all actions run in this workflow write access to all the repository\'s contents. This is a high level of access and could be a security risk. Consider specifying more granular permissions to limit the access of the actions.","path":".github/workflows/pr.yml","line":8},{"body":"The `exclude` parameter is set to exclude all `.json` and `.md` files. If there is a need to review these types of files, consider removing them from the exclude list.","path":".github/workflows/pr.yml","line":[22](https://github.com/LightConsultingInc/alphaedu-FE/actions/runs/7153530492/job/19480089954#step:3:23)}],"event":"COMMENT"}',
    request: { hook: [Function: bound bound register] }
  }
}

Looks like this applys to any changes that happen inside the .github/* folder

Hi @zainlks, I had a similar issue that was resolved by forking the repository and then updating my workflow file to use the name of the forked repository instead of freeedcom/ai-codereviewer@main

Some error : RequestError [HttpError]: Unprocessable Entity: "Pull request review thread line must be part of the diff and Pull request review thread diff hunk can't be blank"

I caught the same issue:

Run vvandriichuk/ai-codereviewer@main
Error: RequestError [HttpError]: Unprocessable Entity: "Pull request review thread path is invalid and Pull request review thread diff hunk can't be blank"
at /home/runner/work/_actions/vvandriichuk/ai-codereviewer/main/webpack:/open-ai-reviewer/node_modules/@octokit/request/dist-node/index.js:78:1
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
status: 422,
response: {
url: 'https://api.github.com/repos/vvandriichuk/fastapi_db_template_02_2024/pulls/6/reviews',
status: 422,
headers: {
'access-control-allow-origin': '*',
'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset',
connection: 'close',
'content-length': '246',
'content-security-policy': "default-src 'none'",
'content-type': 'application/json; charset=utf-8',
date: 'Sat, 16 Mar 2024 13:17:17 GMT',
'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
server: 'GitHub.com',
'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
vary: 'Accept-Encoding, Accept, X-Requested-With',
'x-accepted-github-permissions': 'pull_requests=write',
'x-content-type-options': 'nosniff',
'x-frame-options': 'deny',
'x-github-api-version-selected': '2022-11-28',
'x-github-media-type': 'github.v3; format=json',
'x-github-request-id': '1400:78F9:1843BAE:2DA7574:65F59BDB',
'x-ratelimit-limit': '5000',
'x-ratelimit-remaining': '4994',
'x-ratelimit-reset': '1710598299',
'x-ratelimit-resource': 'core',
'x-ratelimit-used': '6',
'x-xss-protection': '0'
},
data: {
message: 'Unprocessable Entity',
errors: [Array],
documentation_url: 'https://docs.github.com/rest/pulls/reviews#create-a-review-for-a-pull-request'
}
},
request: {
method: 'POST',
url: 'https://api.github.com/repos/vvandriichuk/fastapi_db_template_02_2024/pulls/6/reviews',
headers: {
accept: 'application/vnd.github.v3+json',
'user-agent': 'octokit-rest.js/19.0.7 octokit-core.js/4.2.0 Node.js/16.20.2 (linux; x64)',
authorization: 'token [REDACTED]',
'content-type': 'application/json; charset=utf-8'
},
body: '{"comments":[{"body":"The @staticmethod decorator is not necessary when using the @field_validator decorator from Pydantic. The @field_validator should be applied to instance methods, and the cls parameter should be ... {"body":"Ensure that the input s is of a type that has the .lower() method, such as str, to avoid AttributeError when a non-string type is passed.","path":"app/utils/str_to_bool.py","line":2}],"event":"COMMENT"}',
request: { hook: [Function: bound bound register] }
}
}

It happened when I fixed some issues in PR that AI Assistant commented and re-updated PR with fixed issues.

We got this when rebasing, maybe the action doesn't like that type of branch operation?