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

Vite crashes when it shouldn't with "line must be greater than 0" #1240

Open
1 task done
Readf0x opened this issue Nov 8, 2023 · 3 comments
Open
1 task done

Vite crashes when it shouldn't with "line must be greater than 0" #1240

Readf0x opened this issue Nov 8, 2023 · 3 comments
Labels

Comments

@Readf0x
Copy link

Readf0x commented Nov 8, 2023

Describe the bug

Very often when I'm using stackblitz, I'll make a change to my code that will create an error. Oh well, no biggie, vite will let me just undo the change and, wait what do you mean vite crashed? That's not supposed to happen.
So I check the error log and I see:

Error: `line` must be greater than 0 (lines start at line 1)
    at originalPositionFor$1 (/home/Readf0x/site-rewrite/node_modules/vite/dist/node/chunks/dep-2b82a1ce.js:10179:19)
    at eval (/home/Readf0x/site-rewrite/node_modules/vite/dist/node/chunks/dep-2b82a1ce.js:55901:25)
    at eval (/home/Readf0x/site-rewrite/node_modules/vite/dist/node/chunks/dep-2b82a1ce.js:55892:21)
    at ssrRewriteStacktrace (/home/Readf0x/site-rewrite/node_modules/vite/dist/node/chunks/dep-2b82a1ce.js:55891:10)
    at ssrFixStacktrace (/home/Readf0x/site-rewrite/node_modules/vite/dist/node/chunks/dep-2b82a1ce.js:55944:24)
    at Object.ssrFixStacktrace (/home/Readf0x/site-rewrite/node_modules/vite/dist/node/chunks/dep-2b82a1ce.js:65132:13)
    at fix_stack_trace (/home/Readf0x/site-rewrite/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:273:8)
    at eval (/home/Readf0x/site-rewrite/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:547:13)

Right now, I'm encountering this error whenever I edit a specific css file. Since I'm currently working on the slowest laptop known to man, it can take upwards of 20s to restart the vite server, and css is something I have to edit quite frequently.

I really couldn't tell you why this happens, but it is a frequent occurrence. It also occurs when you go to a route that doesn't exist without a dynamic route error handler.

Link to the blitz that caused the error

https://stackblitz.com/github/Readf0x/site-rewrite/tree/d0bc67bf20e7ecafb65b320965cdf20bc36ebdf2?file=src%2Flib%2Fprism%2Fcatppuccin.css

Steps to reproduce

In the preview, navigate to the "/about" route (accessible navbar, hamburger menu if preview has small width, or direct url)
Edit css file
Upon attempt to reload page, vite will crash with Error: `line` must be greater than 0 (lines start at line 1)

Expected behavior

Vite should not crash in this instance, it should at worst return with a 500 internal server error.

Parity with Local

Screenshots

No response

Platform

Version = 1.80.0
Hash = 1237962aa439bdb72a334d69943149e74bd625c0
WebContainer = 5a198b5c

Browser name  = Chrome
Full version  = 119.0.0.0
Major version = 119
navigator.appName = Netscape
navigator.userAgent = Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0
performance.memory = {
  "totalJSHeapSize": 298828266,
  "usedJSHeapSize": 288913566,
  "jsHeapSizeLimit": 2172649472
}

Additional context

The exact line I'm editing is line 35. There is a 100% chance of this error occurring when changing the rule name from "overflow-x" to "overflow".

@jrvidal
Copy link
Contributor

jrvidal commented Nov 9, 2023

👋 Thanks for the report, this looks like a bug on our side. I've now added it to our internal tracker.

@jrvidal jrvidal added the tracked label Nov 9, 2023
@Readf0x
Copy link
Author

Readf0x commented Nov 9, 2023

👋 Thanks for the report, this looks like a bug on our side. I've now added it to our internal tracker.

Sorry about the lack of professionalism, I was extremely annoyed at the time of posting :P

@hybridherbst
Copy link

The issue still happens. For me, it happens basically whenever I do anything with Sveltekit on StackBlitz at some point, and from then on it's impossible to get it to work again.

Reproduction page: https://stackblitz.com/edit/sveltejs-kit-template-default-36pavj?file=package.json

@jrvidal any news about the internal issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants