When I add Claude's token in dify, it appears: '>' not supported between instances of 'NoneType' and 'int' #13075

Closed
opened 2026-02-21 19:10:27 -05:00 by yindo · 4 comments
Owner

Originally created by @Vampxgg on GitHub (Apr 17, 2025).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.2.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

When I add Claude's token in dify, it appears: '>' not supported between instances of 'NoneType' and 'int'

Image

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @Vampxgg on GitHub (Apr 17, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.2.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce When I add Claude's token in dify, it appears: '>' not supported between instances of 'NoneType' and 'int' ![Image](https://github.com/user-attachments/assets/8887a99c-1c91-41de-a5eb-d2e3edc0bd5b) ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 19:10:27 -05:00
yindo closed this issue 2026-02-21 19:10:27 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Apr 17, 2025):

I found similar threads related to the error you're encountering:

  1. An unsolved discussion titled ‘>’ not supported between instances of ‘NoneType’ and ‘int’ [1].
  2. A closed issue titled "Error with 'Sonnet 3.5' model on Dify: '>' not supported between instances of 'NoneType' and 'int'", which was resolved by a pull request: fix: anthropic max token NoneType error [2].
  3. Another closed issue titled New Error on using Anthropic’s API for all Agents on Dify, also resolved by the same pull request [3].

The pull request that resolved these issues addressed the NoneType error related to token handling for Anthropic models. You might want to check if your version includes this fix or consider updating to a version that does.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (Apr 17, 2025): <!-- Answer --> I found similar threads related to the error you're encountering: 1. An unsolved discussion titled [‘>’ not supported between instances of ‘NoneType’ and ‘int’](https://github.com/langgenius/dify/discussions/5525) <sup>[[1]](https://github.com/langgenius/dify/discussions/5525)</sup>. 2. A closed issue titled ["Error with 'Sonnet 3.5' model on Dify: '>' not supported between instances of 'NoneType' and 'int'"](https://github.com/langgenius/dify/issues/6851), which was resolved by a pull request: [fix: anthropic max token NoneType error](https://github.com/langgenius/dify/pull/6858) <sup>[[2]](https://github.com/langgenius/dify/issues/6851)</sup>. 3. Another closed issue titled [New Error on using Anthropic’s API for all Agents on Dify](https://github.com/langgenius/dify/issues/6853), also resolved by the same pull request <sup>[[3]](https://github.com/langgenius/dify/issues/6853)</sup>. The pull request that resolved these issues addressed the `NoneType` error related to token handling for Anthropic models. You might want to check if your version includes this fix or consider updating to a version that does. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/6b24f974-0554-490c-bf32-b3c0ffadd042?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/6b24f974-0554-490c-bf32-b3c0ffadd042?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/6b24f974-0554-490c-bf32-b3c0ffadd042?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/6b24f974-0554-490c-bf32-b3c0ffadd042?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/6b24f974-0554-490c-bf32-b3c0ffadd042?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/6b24f974-0554-490c-bf32-b3c0ffadd042?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/6b24f974-0554-490c-bf32-b3c0ffadd042?feedback_type=other)</sup>
Author
Owner

@Vampxgg commented on GitHub (Apr 17, 2025):

API Key 或 API URL 没有填写完整或有误; 接口响应数据有字段为 null/None,代码后续处理时与数字比较导致异常; 你的平台(比如云雀、One API等)对 Anthropic 的适配有 bug。 更多:https://code.mayoubang.cn/conversion/share/58908067868更多https://code.mayoubang.cn/conversion/share/58908067868
Ok, I thought I would check if there are any extra spaces first, my KEY does work fine in pycharm

@Vampxgg commented on GitHub (Apr 17, 2025): > API Key 或 API URL 没有填写完整或有误; 接口响应数据有字段为 null/None,代码后续处理时与数字比较导致异常; 你的平台(比如云雀、One API等)对 Anthropic 的适配有 bug。 更多:https://code.mayoubang.cn/conversion/share/58908067868更多: https://code.mayoubang.cn/conversion/share/58908067868 Ok, I thought I would check if there are any extra spaces first, my KEY does work fine in pycharm
Author
Owner

@crazywoola commented on GitHub (Apr 18, 2025):

This is a problem with the provider itself api.gptsapi.net.

@crazywoola commented on GitHub (Apr 18, 2025): This is a problem with the provider itself `api.gptsapi.net`.
Author
Owner

@Vampxgg commented on GitHub (Apr 18, 2025):

This is a problem with the provider itself api.gptsapi.net.这是提供商本身 api.gptsapi.net 的问题。

My OpenAI token from the same service provider can be used normally in Dify, and my Anthropic token from the same service provider can be used in PyCharm, why can't it be used in Dify? ?

@Vampxgg commented on GitHub (Apr 18, 2025): > This is a problem with the provider itself `api.gptsapi.net`.这是提供商本身 `api.gptsapi.net` 的问题。 My OpenAI token from the same service provider can be used normally in Dify, and my Anthropic token from the same service provider can be used in PyCharm, why can't it be used in Dify? ?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#13075