Code block error

default discord avatar
6 months ago

Any idea why I get this error:

Collection "posts" > Field "content" > "value" does not match any of the allowed types

When adding this block to a block field in a collection:

import { Block } from "payload/types";

const CodeBlock: Block = {
  slug: "Code",
  fields: [
      name: "content",
      type: "code",
      required: true,
      admin: { editorOptions: { minimap: false } },

export default CodeBlock;
  • default discord avatar
    6 months ago

    Can we check out the posts collection defenition too?

  • discord user avatar
    Payload Team
    5 months ago

    Hey @toolreaz - were you able to figure out what was happening here? Would love to get to the bottom of this 👍

  • default discord avatar
    5 months ago

    Hi @patrikkozak , it looks like it's the editorOptions which is causing the error even if its empty> Removing it solves the issue

    And btw I did a misstake in my example, it should be

    admin: { editorOptions: { minimap: { enabled: false } } },
Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!


Connect with the Payload Community on Discord



Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.