Skip to content

Generate or edit Python code in a cell with AI could incorrectly produce Markdown code blocks #7500

@harry-xm

Description

@harry-xm

Describe the bug

Image

and when executed it throws an error:

Image

I'm using an OpenAI-compatible provider with glm-4.6 model and have no "custom rules" set.

Will you submit a PR?

  • Yes

Environment

{
  "marimo": "0.18.4",
  "editable": false,
  "location": "/Users/<redacted>/.venv/lib/python3.12/site-packages/marimo",
  "OS": "Darwin",
  "OS Version": "25.2.0",
  "Processor": "arm",
  "Python Version": "3.12.11",
  "Locale": "en_US",
  "Binaries": {
    "Browser": "143.0.7499.42",
    "Node": "v24.11.1"
  },
  "Dependencies": {
    "click": "8.3.1",
    "docutils": "0.22.3",
    "itsdangerous": "2.2.0",
    "jedi": "0.19.2",
    "markdown": "3.10",
    "narwhals": "2.13.0",
    "packaging": "25.0",
    "psutil": "7.1.3",
    "pygments": "2.19.2",
    "pymdown-extensions": "10.18",
    "pyyaml": "6.0.3",
    "starlette": "0.50.0",
    "tomlkit": "0.13.3",
    "typing-extensions": "4.15.0",
    "uvicorn": "0.38.0",
    "websockets": "15.0.1"
  },
  "Optional Dependencies": {
    "altair": "6.0.0",
    "loro": "1.10.3",
    "openai": "2.9.0",
    "pandas": "2.3.3",
    "polars": "1.35.2",
    "pyarrow": "22.0.0"
  },
  "Experimental Flags": {}
}

Code to reproduce

Count number of records in df

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions