Repository navigation
some new type errors #44038
Copy link
Copy link
Open
Labels
review: highghfind author score; see https://ghfind.comghfind author score; see https://ghfind.com
Description
Warning: `ValidationError` is already caught earlier in this `try` statement, so it never matches here
Warning: `ValidationError` is already caught earlier in this `try` statement, so it never matches here
Warning: `AgentAppNotPublishedError` is already caught earlier in this `try` statement, so it never matches here
Warning: `ValidationError` is already caught earlier in this `try` statement, so it never matches here
Warning: `JSONDecodeError` is already caught earlier in this `try` statement, so it never matches here
Warning: `JSONDecodeError` is already caught earlier in this `try` statement, so it never matches here
Warning: `JSONDecodeError` is already caught earlier in this `try` statement, so it never matches here
Warning: `UnicodeDecodeError` is already caught earlier in this `try` statement, so it never matches here
Warning: `JSONDecodeError` is already caught earlier in this `try` statement, so it never matches here
Warning: `ValidationError` is already caught earlier in this `try` statement, so it never matches here
Warning: This code is unreachable
Warning: `ValidationError` is already caught earlier in this `try` statement, so it never matches here
Warning: `ValidationError` is already caught earlier in this `try` statement, so it never matches here
Warning: This code is unreachable
Warning: This code is unreachable
Warning: `DocumentIndexingError` is already caught earlier in this `try` statement, so it never matches here
Warning: `ValidationError` is already caught earlier in this `try` statement, so it never matches here
INFO Checking project configured at `/home/runner/work/dify/dify/api/tests/unit_tests/pyrefly.toml`
Error: Argument `(ParamSpec(Unknown)) -> Unknown` is not assignable to parameter `func` with type `(...) -> @_` in function `unwrap`
Error: Argument `(ParamSpec(Unknown)) -> Unknown` is not assignable to parameter `func` with type `(...) -> @_` in function `unwrap`
Error: Argument `(ParamSpec(Unknown)) -> Unknown` is not assignable to parameter `func` with type `(...) -> Any` in function `inspect.unwrap`
Error: Argument `(ParamSpec(Unknown)) -> Unknown` is not assignable to parameter `func` with type `(...) -> Any` in function `inspect.unwrap`
Error: Argument `(ParamSpec(Unknown)) -> Unknown` is not assignable to parameter `func` with type `(...) -> Any` in function `inspect.unwrap`
Error: Argument `(ParamSpec(Unknown)) -> Unknown` is not assignable to parameter `func` with type `(...) -> Any` in function `inspect.unwrap`
Error: Argument `(ParamSpec(Unknown)) -> Unknown` is not assignable to parameter `func` with type `(...) -> Any` in function `inspect.unwrap`
Error: Argument `(ParamSpec(Unknown)) -> Unknown` is not assignable to parameter `func` with type `(...) -> Any` in function `inspect.unwrap`
Error: Argument `(ParamSpec(Unknown)) -> Unknown` is not assignable to parameter `func` with type `(...) -> Any` in function `inspect.unwrap`
Error: Argument `(ParamSpec(Unknown)) -> Unknown` is not assignable to parameter `func` with type `(...) -> Any` in function `inspect.unwrap`
@dosu how to fix
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
review: highghfind author score; see https://ghfind.comghfind author score; see https://ghfind.com
Activity
dosubot commentedon Oct 14, 2026
I’d handle these in two groups: redundant exception catches, and unresolved decorator typing at the
unwrapboundary. The excerpt omits filenames and line numbers, so I can suggest the fix patterns, but not map all ten errors to exact call sites. [1]Exception warnings: remove redundant subclasses from an exception tuple when they receive the same handling. For example,
api/controllers/console/app/workflow.pyhas:Since Pydantic’s
ValidationErroris aValueError, this can becomeexcept ValueError:. If separate handlers intentionally produce different responses, put the specific exception first instead of deleting it. Python uses the first matching handler. Apply the same reasoning toJSONDecodeErrorandUnicodeDecodeErrorunderValueError. [2]Don’t blanket-delete the domain-error handlers: the web completion handler, for example, translates
AgentAppNotPublishedErrorinto a specific API error before the generic catches. Check the earlier handler and inheritance at each reported location. [3]unwraperrors: these suggest Pyrefly hasn’t resolved the decorated callable’sParamSpec. A targeted workaround to try in the tests is casting the input tounwrap, not only its result:This example replaces an existing
inspect.unwrap(AudioApi.post)call. Keep the cast at the test boundary rather than weakening production decorator types. The session decorator intentionally removes the injectedSessionfrom the public signature, while these tests unwrap it to pass a session explicitly. [4] [5]Recheck with
make type-checkfrom the repository root. I can’t run Pyrefly here, so the cast needs verification with your checker version. Please include the diagnostic filenames/line numbers and Pyrefly version, especially for the standalone “This code is unreachable” warnings. [6]To reply, just mention @dosu.
Share context across your team and agents. Try Dosu.