You asked Lovable to change the button on your pricing page. It changed the button on your settings page instead. Or it “fixed” the header on the wrong layout component entirely, and now you’ve got two things broken instead of one.
If you searched something like “lovable wrong file,” “lovable edit not applied,” or “lovable changed the wrong thing,” this is that bug — and it’s common enough that it’s worth understanding why it happens before you burn another prompt on it.
Why Lovable edits the wrong component
Lovable’s agent decides which file to touch based on the conversation context, not by asking you to point at the file directly. In a short session, on a simple app, that usually works fine — there’s only one obvious candidate.
The problem shows up as your session gets longer or your codebase grows. A few things compound:
- Context tracking drifts over a long conversation. Ten prompts in, the agent’s working memory of “which component we’re currently talking about” isn’t the same as yours. You’ve mentally moved on to the next screen; the agent is still weighting earlier context.
- Similarly named or visually similar components confuse the match. If you have a
Headerand aHeaderMobile, or two card components that render almost identically, the agent can genuinely pick the wrong one — especially if your prompt describes the visual result (“the box at the top”) rather than naming the file. - Vague follow-ups make it worse. “No, fix the other one” or “that’s not right, try again” gives the agent no new information about which file you mean — it just retries against its existing (wrong) guess, or picks a different wrong one.
None of this is a sign your app is broken. It’s a targeting problem: the agent is confident, just confidently pointed at the wrong file.
Reproducing it
This is easy to hit on purpose if you want to confirm you’re looking at the same bug:
- Open a Lovable project with at least two components that share naming or visual similarity (e.g., a card used in two places, or a header/footer pair).
- Have a longer conversation first — a handful of unrelated edits — so the session has some length to it.
- Ask for a small, specific visual change (“make the CTA button orange”) without naming the component or file.
- Check which file the diff actually touched.
The manual fix — scope your next prompt precisely
The fix isn’t a magic phrase, it’s specificity. Here’s the sequence that reliably gets Lovable back on target:
- Open the file tree and find the exact component name. Don’t describe it visually — get the literal filename (e.g.,
PricingCTAButton.tsx, not “the pricing button”). - Name that file explicitly in your prompt. Start the message with it: “In
PricingCTAButton.tsx, change…” Lovable’s agent uses this as a hard anchor instead of inferring from conversation history. - Paste the actual code block you want changed, not just a description of it. Copy the relevant JSX/CSS snippet from the file into your prompt. This removes any ambiguity about which instance of a repeated pattern you mean.
- State the wrong outcome and the right outcome as two separate, concrete sentences. For example: “Right now the button is blue and located in
SettingsPage.tsx— that’s the wrong file. I want the orange button inPricingCTAButton.tsx, specifically the<Button variant='cta'>element.” Naming both the mistake and the target in the same prompt stops the agent from re-guessing. - If it still lands wrong, don’t say “try again.” Undo/revert the incorrect edit first, then resend the scoped prompt above as a fresh message. Stacking a vague correction on top of a wrong edit is how these sessions spiral into two or three broken files instead of one.
This is slower than typing “no, the other one” — but it’s the difference between a fix that lands in one shot and a fix-loop that burns several prompts (and, on usage-based plans, real credits) chasing the same bug.
If you find yourself doing this a lot — writing out “here’s what’s wrong, here’s the exact file, here’s the exact right outcome” by hand every time — that’s the exact structure Traileo turns into a one-click step: you point at the actual element in your live app, and it generates a fix request with the component, the wrong state, and the intended state already scoped, instead of you retyping that structure from memory each time.
How to verify the fix actually landed
Don’t just glance at the preview — the preview can look right while the wrong file changed underneath it (or vice versa, if you have duplicate-looking components).
- Open the diff/changed-files view for the last edit and confirm the filename matches the one you named in your prompt.
- Open that specific file and check the changed element matches what you described (not just “a button changed somewhere”).
- Reload the preview and manually navigate to the page/state where the original wrong edit landed, to confirm it’s back to normal (if you reverted it).
- If you’re not sure, ask Lovable directly: “Which file did you just edit?” — and cross-check the answer against the diff, not just its text response.