Troubleshooting
CBWIRE integrates complex technologies like Livewire's DOM diffing, Alpine.js reactivity, and server-side rendering. This guide addresses the most common issues you'll encounter and provides practical solutions with detailed examples.
CBWIRE Component Issues
Lazy-Loaded Components with Placeholders Don't Render
Problem: You get a "Snapshot missing on Livewire component" error when using lazy loading with placeholders.
Root Cause: Mismatch between placeholder and template outer elements confuses Livewire's DOM diffing engine.
Error: Snapshot missing on Livewire component with id...
Solution: Match outer elements exactly between placeholder and template.
// wires/Widget.bx
class extends="cbwire.models.Component" {
function placeholder() {
return "<div>put spinner here...</div>"; // ✅ Matches template
}
}// wires/Widget.cfc
component extends="cbwire.models.Component" {
function placeholder() {
return "<div>put spinner here...</div>"; // ✅ Matches template
}
}<!-- wires/widget.bxm -->
<bx:output>
<div> <!-- ✅ Matches placeholder's <div> -->
<h1>My Widget</h1>
</div>
</bx:output><!-- wires/widget.cfm -->
<cfoutput>
<div> <!-- ✅ Matches placeholder's <div> -->
<h1>My Widget</h1>
</div>
</cfoutput>Conditional Rendering Issues
Problem: Livewire fails to detect conditional sections appearing/disappearing, causing rendering glitches.
Root Cause: Complex nested conditionals can confuse Livewire's DOM diffing algorithm.
Solution: Add wire:key to conditional elements (recommended approach).
Alternative Solution: If wire:key doesn't solve the issue, add conditional block markers.
Block Marker Syntax:
Server Configuration Issues
400 Bad Request on CBWIRE Updates
Problem: The /cbwire/update endpoint returns "400 Bad Request" errors, preventing CBWIRE components from updating.
Root Cause: Server software or connectors stripping out the X-Livewire header that CBWIRE requires for request handling.
Error: HTTP 400 status code when CBWIRE attempts to process component updates.
Solution: Configure your server software to allow empty headers or preserve the X-Livewire header.
BonCode AJP Connector (IIS + Lucee)
If you're running Lucee behind IIS using the BonCode AJP Connector, you need to allow empty headers:
File: /BIN/BonCodeAJP13.settings
After making this change, restart your web server for the setting to take effect.
Other Server Software
The X-Livewire header is essential for CBWIRE to function properly. If you're experiencing 400 errors with other server configurations:
Check server logs - Look for messages about rejected or stripped headers
Review proxy settings - Ensure reverse proxies (nginx, Apache) pass through the
X-LivewireheaderCheck security modules - WAF or security modules might be filtering custom headers
Test header presence - Use browser developer tools to verify the
X-Livewireheader is being sent
Example nginx configuration to preserve headers:
Example Apache configuration to preserve headers:
CBWIRE depends on the X-Livewire header for proper request routing and component identification. If this header is stripped or blocked by your server configuration, CBWIRE will return 400 errors and components will fail to update.
Alpine.js Integration Issues
Quote Syntax Errors in x-data
Problem: JavaScript errors when using double quotes inside x-data attributes.
Root Cause: HTML attribute already uses double quotes, creating syntax conflicts.
Error: JavaScript syntax error in browser console.
Solution: Use single quotes inside x-data blocks.
Component Removal with Alpine x-if
Problem: "Unable to find component" errors when using x-if with CBWIRE components.
Root Cause: Alpine's x-if completely removes/recreates DOM elements, breaking Livewire's component tracking.
Error: Unable to find component K8SDFLSDF902KSDFLASKJFASDFLJ.
Solution: Replace x-if with x-show to preserve DOM elements.
Key Differences: x-if vs x-show
x-if
Removes/recreates DOM elements
❌ Breaks component tracking
x-show
Toggles CSS display property
✅ Preserves component tracking
Quick Reference
Essential Rules
Placeholder-Template Matching: Outer elements must be identical
Conditional Blocks: Wrap complex conditionals with
<!--[if BLOCK]><![endif]-->markersAlpine Quotes: Always use single quotes inside
x-dataattributesComponent Visibility: Use
x-showinstead ofx-ifwith CBWIRE components
Common Error Messages
"Snapshot missing"
Placeholder/template mismatch
Match outer elements exactly
"Unable to find component"
Alpine x-if removing components
Use x-show instead
JavaScript syntax error
Double quotes in x-data
Use single quotes
400 Bad Request
X-Livewire header stripped by server
Configure server to allow empty headers
Last updated
Was this helpful?