{"record":{"id":"4b4737d33b6d9b81","repo":"pbakaus/impeccable","slug":"note-could-not-remove-live-script-tag-first","errorCode":null,"errorMessage":"Note: could not remove live script tag ({first})\n","messagePattern":"Note: could not remove live script tag \\((.+?)\\)\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/live/src/live_server.rs","lineNumber":492,"sourceCode":"                    if j.get(\"removed\") == Some(&Value::Bool(true)) {\n                        let file = j\n                            .get(\"file\")\n                            .map(js_display)\n                            .unwrap_or_else(|| \"undefined\".to_string());\n                        println(io, &format!(\"Removed live script tag from {}.\", file));\n                    }\n                }\n            }\n        } else {\n            let detail = if !err.trim().is_empty() {\n                err.trim().to_string()\n            } else if !out.trim().is_empty() {\n                out.trim().to_string()\n            } else {\n                format!(\"Command failed: impeccable live-inject --remove\")\n            };\n            let first = detail.split('\\n').next().unwrap_or(\"\");\n            io.err(&format!(\n                \"Note: could not remove live script tag ({})\\n\",\n                first\n            ));\n        }\n    }\n    0\n}\n\n/// JS: shutdown()\nfn shutdown(shared: &Shared) {\n    let mut st = lock(shared);\n    if st.cleaned_up {\n        return;\n    }\n    st.cleaned_up = true;\n    remove_all_svelte_component_sessions(&st.cwd);\n    remove_live_server_info(&st.cwd, &st.env);\n    st.lease_timer_gen += 1;","sourceCodeStart":474,"sourceCodeEnd":510,"githubUrl":"https://github.com/pbakaus/impeccable/blob/2bc2879276c1f321a53c4ca99d3371e411329b52/crates/live/src/live_server.rs#L474-L510","documentation":"During `impeccable live` shutdown (stop, called by run), the tool tries to remove the injected live script tag by re-running `impeccable live-inject --remove`. If that command fails, it prints the first line of the failing command's output as a non-fatal 'Note:' warning. The live session still ends; the injected script tag may be left behind in the HTML file.","triggerScenarios":"Running `impeccable live` and stopping it (Ctrl-C or shutdown) when the `live-inject --remove` subcommand exits non-zero or emits an error — e.g. the target HTML file was moved, renamed, deleted, or edited so the marker no longer matches while the session ran.","commonSituations":"Developer deletes or restructures the entry HTML during a live session; a git checkout/branch switch replaces the injected file; the file is locked by another process (editor, dev server) so the rewrite fails; the project root changed mid-session.","solutions":["Open the HTML file the live session was serving and manually remove the injected live script tag (search for the live/inject marker comment or script).","Re-run `impeccable live` on the same target and stop it cleanly so removal succeeds.","Check the file still exists at the original path and is writable (`ls`, permissions) before restarting live mode.","If a dev server or watcher rewrote the file, stop it, re-add/remove the tag, then restart live."],"exampleFix":"// The injected tag typically looks like:\n// <script src=\"http://localhost:PORT/impeccable-live.js\"></script>\n// before (leftover after failed auto-removal)\n<script src=\"http://localhost:7d34/impeccable-live.js\"></script>\n// after (manually deleted)\n","handlingStrategy":"fallback","validationCode":"test -f index.html && grep -q 'impeccable-live' index.html && echo 'tag present, removable' || echo 'file missing or tag absent'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Don't delete or rename the injected HTML file while a live session is running.","Avoid git branch switches/checkouts that touch the target file during a live session.","Grep for the live script tag after stopping a session and remove it manually if the note appeared.","Keep dev-server watchers from rewriting the file while live mode is active."],"tags":["cleanup","live-mode","html","non-fatal"],"backgroundTag":"cleanup-command-failed","analyzedSha":"2bc2879276c1f321a53c4ca99d3371e411329b52","analyzedAt":"2026-09-08T04:51:14.109Z","contentChangedAt":"2026-09-08T04:51:14.109Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}