Liquid Code Error After Customizing Theme Sections

Topic summary

A user encountered a Liquid syntax error on line 45 (“Unexpected character”) after adding custom code for a dynamic banner on Shopify collection pages. The banner fails to render, and reverting the section didn’t resolve the issue.

Community responses suggest:

  • Sharing the full code or a screenshot of line 45 for diagnosis
  • Checking for common syntax errors: stray brackets {}, missing {% endif %} tags, or invalid filter syntax
  • Looking 2-3 lines before/after line 45 for the actual error location
  • Possibility of AI-generated code containing illegal characters in comments
  • Temporarily commenting out the custom snippet (e.g., {% render 'your-banner' %}) to isolate the problem

Status: The issue remains unresolved and open. Multiple users are waiting for the original poster to provide the problematic code or screenshots to offer specific fixes.

Summarized with AI on October 25. AI used: claude-sonnet-4-5-20250929.

Hi, I added some custom Liquid code to my Shopify theme to display a dynamic banner on collection pages. Since then, I’m seeing the error “Liquid syntax error (line 45): Unexpected character” and my banner is not rendering. I tried reverting that section but the error still shows. Does anyone know if this could be related to cached theme files or a missing variable in the snippet?

Regards

Hey @AulLaep

Can you share a screenshot of line number 45 when you try to save the file?

Best,
Moeed

@AulLaep Thanks for posting here.

Can you please share the full file code here, or the error line code, and a screenshot?

I can see there are lot of issues with your current code. But it’s important that you need to share the whole code of collection.liquid file so that I can provide you the fixed version of the code.
Thanks

Hi - Have you used AI to generate this code, I think if you go to line 45 you will find a comment with an illegal character. Ask your AI to fix it for you maybe?

Derek

Hi @AulLaep ,
That error means there’s a typo in your Liquid — usually a stray {}, missing {% endif %}, or bad filter syntax.

Check around line 45 (and 2–3 lines before/after). If you used a snippet, comment out {% render 'your-banner' %} to confirm it’s the cause.

Please share those lines here if you want me to spot the exact issue.

There should exist a highlighted part in line 45 of this issue related liquid file. Go to check and find it, then correct the wrong characters and this issue shall be done.