Installation issues
NPM installation fails
If you encounter errors during installation:Permission errors on global install
If you seeEACCES permission errors:
Schema loading errors
”Flag output (-o, —output) is required”
This error occurs when you don’t specify an output directory. Solution: Always provide the-o or --output flag:
“Endpoint (—endpoint, -e) or Schema File (—schema, -s) are require.”
GraphDoc needs either a schema file or an endpoint to generate documentation. Solution: Provide one of the following:Using a GraphQL endpoint
Using a GraphQL endpoint
Using a schema file
Using a schema file
“Unexpected schema extension name”
GraphDoc only supports specific schema file formats. This error appears when you use an unsupported file extension. Supported formats:.json- JSON introspection result.graphql- GraphQL IDL/SDL format.gql- GraphQL IDL/SDL format.gqls- GraphQL IDL/SDL format.graphqls- GraphQL IDL/SDL format.js- JavaScript modularized schema
“Unexpected HTTP Status Code”
This error occurs when the GraphQL endpoint returns a non-200 status code. Common causes:Authentication required
Authentication required
Add authentication headers using the
-x flag:Wrong endpoint URL
Wrong endpoint URL
Verify your endpoint URL is correct:
CORS or network issues
CORS or network issues
Ensure the GraphQL server is accessible from your machine and doesn’t have CORS restrictions for introspection queries.
”Unexpected response from endpoint”
This error occurs when the endpoint returns invalid JSON or non-GraphQL response. Solution:Check introspection is enabled
Some GraphQL servers disable introspection in production. Ensure it’s enabled or use a schema file instead.
JSON schema file errors
If you’re loading a.json schema file and encounter errors:
Solution: Ensure your JSON file contains a valid introspection query result. It should have one of these structures:
IDL/GraphQL schema file errors
If you’re loading a.graphql or .gql file and see parsing errors:
Solution: Ensure your schema file:
- Contains valid GraphQL SDL syntax
- Includes all type definitions
- Can be parsed by
buildSchemafrom graphql-js
JavaScript schema loader errors
When using.js schema files, you may see: “Unexpected schema definition on [object], must be an array or function”
Solution: Your JavaScript file must export an array of type definitions or a function returning an array:
Export array of definitions
Export array of definitions
Export function returning array
Export function returning array
Output directory issues
”[directory] already exists (delete it or use the —force flag)”
GraphDoc won’t overwrite an existing output directory by default. Solution: Use the-f or --force flag:
”Unexpected output: [path] is not a directory”
The output path exists but is a file, not a directory. Solution: Remove the file or choose a different output path:“The index partial is missing”
This error occurs when the template directory doesn’t contain anindex.mustache file.
Solution: Use the default template or ensure your custom template includes index.mustache:
Plugin errors
Plugin loading fails
If a plugin can’t be loaded:Check plugin exports default
Plugins must export a default constructor or object. See lib/command.ts:266-272.
Default plugin not found
If you see errors about the default plugin: Solution: The default plugin should be atgraphdoc/plugins/default. If it’s missing, reinstall GraphDoc:
Configuration issues
package.json configuration not loading
If yourpackage.json configuration isn’t being read:
Custom data injection issues
When using the-d or --data flag:
Solution: Ensure you’re passing valid JSON:
Template issues
Custom template not found
If your custom template can’t be loaded: Solution: Provide the absolute path or relative path from your project root:.mustache files, including index.mustache.
Template rendering errors
If you see Mustache template errors:Check template syntax
Check template syntax
Ensure your
.mustache files have valid syntax. Common issues:- Unclosed tags:
{{#section}}without{{/section}} - Incorrect variable names
- Invalid partials references
Verify partials
Verify partials
All partials must be separate
.mustache files in the template directory.Debugging tips
Enable verbose output
Use the-v or --verbose flag to see detailed information:
- Plugin loading information
- Asset collection details
- File rendering progress
- Full error stack traces
Check GraphDoc version
Test schema loading separately
Create a simple test script to verify your schema loads correctly:Validate your GraphQL endpoint
Test your endpoint with a simple introspection query:Check for conflicting dependencies
If you’re experiencing strange behavior:graphql installed.
Performance issues
Generation is slow for large schemas
For large schemas (like GitHub’s API with 1000+ types):Out of memory errors
If Node.js runs out of memory:Getting help
If you’re still experiencing issues:Check GitHub issues
Search existing issues: github.com/2fd/graphdoc/issues
GraphDoc uses the
@2fd/command package for CLI parsing and graphql package version 15.x for schema processing.