OctoPrint / OctoPrint/OctoPrint

[Request] Error reporting for broken GCODE scripts

Open
#3,985 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

request
Dominant language
Python
Stars
9.1k
Forks
1.7k
Avg merge
2d 5h
Merged PRs (30d)
4

Description

Is your feature request related to a problem? Please describe.

I have just had an extremely annoying situation where my prints repeatedly failed because I had a plugin referenced in the gcode "before print job" section that I'd uninstalled, and my printer was no longer bed levelling because the gcode script wasn't executing. It took me ages to figure this out.

Errors in custom gcode really need to be flagged up somewhere - personally I'd expect the job to fail and a dialog to pop up. Could things like broken templates be flagged up at the time you attempt to save them in settings?

Originally posted by @Jonty in https://github.com/OctoPrint/OctoPrint/issues/2414#issuecomment-734491009

Describe the solution you'd like

Try to prerender gcode scripts with an example context upon save and check if an error gets produced, if so refuse to save and show a warning to the user. Maybe a testing endpoint is needed that can be called from the frontend?

Describe alternatives you've considered

None

Additional context

#2414

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by tracing the settings flow for custom GCODE and the existing script/template rendering path, then review the related discussion in #2414. Done means invalid scripts are detected on save, the user receives a warning, and any needed frontend testing endpoint is defined.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.