# Schema is missing its top node type ('doc')

**URL:** <https://discuss.prosemirror.net/t/schema-is-missing-its-top-node-type-doc/2988>\
**Category:** Show\
**Created:** [July 12, 2020, 4:38pm UTC](https://discuss.prosemirror.net/t/schema-is-missing-its-top-node-type-doc/2988 "2020-07-12T16:38:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![linusang](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/linusang/32/1632_2.png) [@linusang](https://discuss.prosemirror.net/u/linusang)\
**Post date:** [July 12, 2020, 4:38pm UTC](https://discuss.prosemirror.net/t/schema-is-missing-its-top-node-type-doc/2988/1 "2020-07-12T16:38:12Z")

</div>

i am playing around with the library and currently encountering this issue `Schema is missing its top node type ('doc')` while extending the schema with the following code.

```
import { schema } from "prosemirror-schema-basic";
import { Schema } from "prosemirror-model";
const extendedSchema = new Schema({
    nodes: schema.spec.nodes,
    marks: schema.spec.marks        
});

```

am i missing something?

---

<div class="post-metadata">

**Author:** ![marijn](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/marijn/32/15_2.png) [@marijn](https://discuss.prosemirror.net/u/marijn)\
**Post date:** [July 13, 2020, 6:00am UTC](https://discuss.prosemirror.net/t/schema-is-missing-its-top-node-type-doc/2988/2 "2020-07-13T06:00:22Z")

</div>

That precise code works for me, so I don’t know what’s going wrong. Maybe something with your module loading or bundling setup.

---

<div class="post-metadata">

**Author:** ![linusang](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/linusang/32/1632_2.png) [@linusang](https://discuss.prosemirror.net/u/linusang)\
**Post date:** [July 13, 2020, 12:36pm UTC](https://discuss.prosemirror.net/t/schema-is-missing-its-top-node-type-doc/2988/3 "2020-07-13T12:36:07Z")

</div>

yup i guess you are right, i was using vuejs vite to create my app. So I retried it using Vue 2 CLI and its working. Thanks!

---

<div class="post-metadata">

**Author:** ![iamgabrielsoft](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/iamgabrielsoft/32/3220_2.png) [@iamgabrielsoft](https://discuss.prosemirror.net/u/iamgabrielsoft)\
**Post date:** [May 22, 2023, 11:21pm UTC](https://discuss.prosemirror.net/t/schema-is-missing-its-top-node-type-doc/2988/4 "2023-05-22T23:21:03Z")

</div>

I am getting the same error,

RangeError: Schema is missing its top node type (‘doc’)

I just can’t seem to find out the problem, having commented it with the prosemirror command functionality

---

<div class="post-metadata">

**Author:** ![bZichett](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/bzichett/32/1047_2.png) [@bZichett](https://discuss.prosemirror.net/u/bZichett)\
**Post date:** [August 27, 2025, 8:53pm UTC](https://discuss.prosemirror.net/t/schema-is-missing-its-top-node-type-doc/2988/5 "2025-08-27T20:53:45Z")

</div>

I know this is old, but surprised there wasn’t a resolution proposed, although @marijn basically pointed the way.

The issue is caused by the `instanceof` check on OrderedMap.

[https://github.com/marijnh/orderedmap/blob/master/index.js#L131](https://github.com/marijnh/orderedmap/blob/master/index.js#L131)

I just ran into it, but I recalled an earlier thread where a similar issue happened so I immediately know. Can be fixed in a few ways, and is always external build set up fault. A simple alias on build to always resolve one orderedmap fixes it.

---

<div class="post-metadata">

**Author:** ![bZichett](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/bzichett/32/1047_2.png) [@bZichett](https://discuss.prosemirror.net/u/bZichett)\
**Post date:** [August 27, 2025, 8:57pm UTC](https://discuss.prosemirror.net/t/schema-is-missing-its-top-node-type-doc/2988/6 "2025-08-27T20:57:23Z")

</div>

@marijn The resultant error is definitely opaque. And for the purposes of a library that I’d like to see adopted by as many people as possible, including those using LLMs, I propose that that area of the code have something of a check for this condition, similar to the other part of the code where you suggest that the modules might be different, iirc prosemirror-view or some other module, maybe state. The code past that `if` check gobbles up prototypes, and breaks the contract expected by prosemirror (string, obj, string, obj) etc.

Could be reliably detected, probably more sanely by you. It’s certainly not a big deal, and am OK if you don’t like the idea. My thoughts are simply that it could save other people time chasing their tail. I could propose a PR if you’d like, just let me know.
