Skip to content

Update default actor build endpoint error handling and types#2483

Closed
Pijukatel wants to merge 1 commit intomasterfrom
claude/fix-openapi-autofixes-zfmyg
Closed

Update default actor build endpoint error handling and types#2483
Pijukatel wants to merge 1 commit intomasterfrom
claude/fix-openapi-autofixes-zfmyg

Conversation

@Pijukatel
Copy link
Copy Markdown
Contributor

Summary

This PR updates the OpenAPI specification for the default actor build endpoint to better document error responses and adds new error type definitions to the error type schema.

Key Changes

  • Error response documentation: Updated the 403 response for the default actor build endpoint (GET /actors/{actorId}/builds/default) to clarify that it can be returned in two scenarios:

    • When the default build does not exist (error type unknown-build-tag)
    • When the caller lacks read permission for the Actor (error type insufficient-permissions)
  • Error response schema: Changed the 403 response schema from a specific BuildErrors.yaml#/UnknownBuildTagError reference to the generic ErrorResponse.yaml to accommodate multiple error types

  • New error types: Added two new error type enums to ErrorType.yaml:

    • full-permission-actor-not-approved
    • run-input-body-not-valid-json

Notable Details

The 403 status code is retained for backwards compatibility despite semantically being a 404 scenario (as noted in the referenced PR #17414). The generic error response schema allows the API to return different error types while maintaining the same HTTP status code.

https://claude.ai/code/session_01WBCTVV9U7ctKjB63h9jubi

…t 403 and add missing enum members

Error: WARN Response OpenAPI validation error {"url":"/v2/acts/{actorId}/builds/default","method":"GET","statusCode":403,"errors":[{"message":"must be equal to constant","errorCode":"const.openapi.validation","path":"/response/error/type"}]}
Files: apify-api/openapi/paths/actors/acts@{actorId}@builds@default.yaml:28-37
Root cause: The 403 response schema was hard-pinned to the const "unknown-build-tag" via UnknownBuildTagError, but the endpoint also returns 403 with type "insufficient-permissions" when an unauthenticated or non-owner caller requests a private Actor's default build. Switching the schema to the standard ErrorResponse (which references the ErrorType enum) covers both cases without losing the enum constraint.
Reference: https://github.com/apify/apify-core/tree/57a2fbf9848fa2f64043cdb855a7b95c2a6caad6/src/api/src/routes/actors/build_default.ts#L33

Error: WARN Response OpenAPI validation error {"url":"/v2/schedules","method":"POST","statusCode":400,"errors":[{"message":"must be equal to one of the allowed values: ...[truncated]","errorCode":"enum.openapi.validation","path":"/response/error/type"}]}
Files: apify-api/openapi/components/schemas/common/ErrorType.yaml:301
Root cause: When a Schedule is created with a non-JSON runInput.body, the API throws errors.scheduling.runInputBodyNotValidJson() with type "run-input-body-not-valid-json", which was missing from the ErrorType enum.
Reference: https://github.com/apify/apify-core/tree/57a2fbf9848fa2f64043cdb855a7b95c2a6caad6/src/packages/errors/src/errors/scheduling.ts#L63

Error: WARN Response OpenAPI validation error {"url":"/v2/acts/{actorId}/runs","method":"POST","statusCode":403,"errors":[{"message":"must be equal to one of the allowed values: ...[truncated]","errorCode":"enum.openapi.validation","path":"/response/error/type"}]}
Files: apify-api/openapi/components/schemas/common/ErrorType.yaml:129
Root cause: Running a public full-permission Actor without prior approval throws errors.actor.fullPermissionActorNotApproved with type "full-permission-actor-not-approved", which was missing from the ErrorType enum.
Reference: https://github.com/apify/apify-core/tree/57a2fbf9848fa2f64043cdb855a7b95c2a6caad6/src/packages/errors/src/errors/actor.ts#L58
@github-actions github-actions Bot added this to the 139th sprint - Tooling team milestone Apr 30, 2026
@github-actions github-actions Bot added the t-tooling Issues with this label are in the ownership of the tooling team. label Apr 30, 2026
@Pijukatel Pijukatel closed this Apr 30, 2026
@apify-service-account
Copy link
Copy Markdown

Preview for this PR was built for commit c69420c and is ready at https://pr-2483.preview.docs.apify.com!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants