Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template render error: (unknown path) #2581

Closed
mnlbox opened this issue May 24, 2017 · 4 comments
Closed

Template render error: (unknown path) #2581

mnlbox opened this issue May 24, 2017 · 4 comments

Comments

@mnlbox
Copy link

mnlbox commented May 24, 2017

Node version(node -v):
6.10.2

Hexo and Plugin version(npm ls --depth 0):
├── hexo@3.3.5
├── hexo-generator-feed@1.2.0
├── hexo-generator-index@0.2.1
├── hexo-generator-seo-friendly-sitemap@0.0.21
├── hexo-generator-tag@0.2.0
├── hexo-renderer-ejs@0.2.0
├── hexo-renderer-marked@0.2.11
└── hexo-server@0.2.0

I'm working on a big site (near 10000 posts and more than 100000 tags) based on Hexo. It's return below error after 1 hour process:

Template render error: (unknown path) [Line 1, Column 1915]
  expected variable end
    at Object.exports.prettifyError (/media/mnlbox/883d88ab-430b-4dc8-aff1-7135bb7e1516/Projects/Hexo Static Generator/node_modules/nunjucks/src/lib.js:34:15)
    at new_cls.render (/media/mnlbox/883d88ab-430b-4dc8-aff1-7135bb7e1516/Projects/Hexo Static Generator/node_modules/nunjucks/src/environment.js:469:27)
    at new_cls.renderString (/media/mnlbox/883d88ab-430b-4dc8-aff1-7135bb7e1516/Projects/Hexo Static Generator/node_modules/nunjucks/src/environment.js:327:21)
    at /media/mnlbox/883d88ab-430b-4dc8-aff1-7135bb7e1516/Projects/Hexo Static Generator/node_modules/hexo/lib/extend/tag.js:66:9
    at Promise._execute (/media/mnlbox/883d88ab-430b-4dc8-aff1-7135bb7e1516/Projects/Hexo Static Generator/node_modules/bluebird/js/release/debuggability.js:300:9)
    at Promise._resolveFromExecutor (/media/mnlbox/883d88ab-430b-4dc8-aff1-7135bb7e1516/Projects/Hexo Static Generator/node_modules/bluebird/js/release/promise.js:483:18)
    at new Promise (/media/mnlbox/883d88ab-430b-4dc8-aff1-7135bb7e1516/Projects/Hexo Static Generator/node_modules/bluebird/js/release/promise.js:79:10)
    at Tag.render (/media/mnlbox/883d88ab-430b-4dc8-aff1-7135bb7e1516/Projects/Hexo Static Generator/node_modules/hexo/lib/extend/tag.js:64:10)
    at Object.tagFilter [as onRenderEnd] (/media/mnlbox/883d88ab-430b-4dc8-aff1-7135bb7e1516/Projects/Hexo Static Generator/node_modules/hexo/lib/hexo/post.js:253:16)
    at /media/mnlbox/883d88ab-430b-4dc8-aff1-7135bb7e1516/Projects/Hexo Static Generator/node_modules/hexo/lib/hexo/render.js:65:19
    at tryCatcher (/media/mnlbox/883d88ab-430b-4dc8-aff1-7135bb7e1516/Projects/Hexo Static Generator/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/media/mnlbox/883d88ab-430b-4dc8-aff1-7135bb7e1516/Projects/Hexo Static Generator/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/media/mnlbox/883d88ab-430b-4dc8-aff1-7135bb7e1516/Projects/Hexo Static Generator/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/media/mnlbox/883d88ab-430b-4dc8-aff1-7135bb7e1516/Projects/Hexo Static Generator/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/media/mnlbox/883d88ab-430b-4dc8-aff1-7135bb7e1516/Projects/Hexo Static Generator/node_modules/bluebird/js/release/promise.js:693:18)
    at Async._drainQueue (/media/mnlbox/883d88ab-430b-4dc8-aff1-7135bb7e1516/Projects/Hexo Static Generator/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/media/mnlbox/883d88ab-430b-4dc8-aff1-7135bb7e1516/Projects/Hexo Static Generator/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues (/media/mnlbox/883d88ab-430b-4dc8-aff1-7135bb7e1516/Projects/Hexo Static Generator/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:666:20)
    at tryOnImmediate (timers.js:639:5)
    at processImmediate [as _immediateCallback] (timers.js:611:5)

Suggestion: I think it's better to return bad file path for simpler debug on any error rather than Template render error: (unknown path) message.

Question 1: How we can find which file cause this error now?

Question 2: Can you list bad character in post file (Front matter and markdown part)?
Now I remove & | and * from tags because it cause error for me and also remove < > { } ] and [ from markdown file content. Can you help me to complete this list?

Related Issues: #2384 , #1837

@NoahDragon
Copy link
Member

As the error raised inside the render function(https://github.com/hexojs/hexo/blob/master/lib/extend/tag.js#L66), the path information has already lost.

Another way to avoid this error is to get the version with the #2478 change (not in the main build). You could set a flag disable_nunjucks into _config.yml file to skip rendering tags. But this method is not recommended.

For the Tag renderer, it uses the nunjucks template. So the bad character is usually {{ }}. However, based on the error message you got, it may not cause only by bad characters. mozilla/nunjucks#650

I also could help you to identify the error files if those files are okay to share.

@NoahDragon NoahDragon added the question Needs help in usage label May 24, 2017
@mnlbox
Copy link
Author

mnlbox commented May 29, 2017

@NoahDragon I think disable_nunjucks does not work because it's related PR not merged now #2478.
I want use official version of Hexo. 😉 Is it possible to merge that PR?
My files is not public for all if you can please provide an email to me so I can send my sites post file only to you.

@NoahDragon
Copy link
Member

For the disable_nunjucks changes, we won't merge it to the official Hexo, as it is only a temporal fix.
Here is my email: hi@abnerchou.me

@stale stale bot added the wontfix This will not be worked on label Sep 27, 2017
@stale
Copy link

stale bot commented Sep 27, 2017

This issue has been automatically marked as stale because lack of recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@NoahDragon NoahDragon added stale and removed question Needs help in usage wontfix This will not be worked on labels Sep 27, 2017
@stale stale bot removed the stale label Sep 27, 2017
GoogTech added a commit to GoogTech/blog that referenced this issue Jul 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants