Skip to content

After creating local schema programmatically and restarting, on create entry I get unuseful validation error during save #24757

@inspiraller

Description

@inspiraller

Node Version

22.17.0

NPM/Yarn/PNPM Version

10.18.2

Strapi Version

5.29.0

Operating System

Windows 11

Database

PostgreSQL

Javascript or Typescript

Typescript

Reproduction URL

No response

Bug Description

When trying to SAVE after creating entry for custom schema I get error: Validation error: Invalid status

This is not useful. I am unable to debug.

Steps to Reproduce

  1. Spin up any local posgres db

  2. Create strapi locally (use same env vars for above db)
    pnpx create-strapi-app@latest my_strapi_backend --skip-cloud

  • ? Do you want to use the default database (sqlite) ? (Y/n) n
  • ? Choose your default database client: postgres
  • ? Database name: (strapi)
  • ? Host: (127.0.0.1)
  • ? Port: (5432)
  • ? Username: strapi
  • ? Password: ******
  • ? Enable SSL connection: (y/N) n
  • ? Start with an example structure & data? (y/N) y
  • ? Start with Typescript? (Y/n) y
  • ? Install dependencies with pnpm? (Y/n) y
  • ? Initialize a git repository? (Y/n) y
  • ? Participate in anonymous A/B testing (to improve Strapi)? (y/N) n
  1. Load strapi (install dependencies and start)
  • cd my_strapi_backend
  • pnpm i
  • pnpm dev
  1. open in browser
    localhost:1337

  2. create local account

  3. stop strapi

  4. create this schema.json
    src/api/example-x/content-types/example-x/schema.json

{
  "kind": "collectionType",
  "collectionName": "example-xs",
  "info": {
    "singularName": "example-x",
    "pluralName": "example-xs",
    "displayName": "Example X",
    "description": "The main project schema."
  },
  "options": {
    "draftAndPublish": true
  },
  "pluginOptions": {},
  "attributes": {
    "name": {
      "type": "string",
      "unique": true,
      "required": true
    },
    "status": {
      "type": "string",
      "required": false,
      "unique": false,
      "default": ""
    },
    "sections": {
      "type": "component",
      "repeatable": true,
      "component": "common.section"
    }
  }
}
  1. create nested schema dependencies
  • src/components/common/detail.json
{
  "collectionName": "components_common_details",
  "info": {
    "displayName": "Detail",
    "description": "A deeply nested piece of information."
  },
  "options": {},
  "attributes": {
    "title": {
      "type": "string",
      "required": true
    },
    "description": {
      "type": "text"
    }
  }
}
  • src/components/common/section.json
{
  "collectionName": "components_common_sections",
  "info": {
    "displayName": "Section",
    "description": "A section within the project."
  },
  "options": {},
  "attributes": {
    "heading": {
      "type": "string"
    },
    "content": {
      "type": "text"
    },
    "details": {
      "type": "component",
      "repeatable": true,
      "component": "common.detail"
    }
  }
}
  1. restart strapi
    pnpm dev
  2. Go to - content manager > Example X > Create entry >
  • add a title: example
  • click Save

response

{
    "data": null,
    "error": {
        "status": 400,
        "name": "ValidationError",
        "message": "Validation error: Invalid status",
        "details": {}
    }
}

unuseful error message.

The status should allow any string.
How to debug?

Expected Behavior

Either, it allows me to save, or I see a useful validation error message.

Logs

Code Snippets

No response

Media

No response

Additional information

No response

Confirmation Checklist

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions