Skip to content
CodeRescue

CodeRescue

AI Debugger

Created on 5th May 2026

•

CodeRescue

CodeRescue

AI Debugger

The problem CodeRescue solves

Instant Code Debugging Without Context Switching
Developers waste 30-50% of their debugging time just identifying what's wrong with broken code. CodeRescue eliminates this by providing instant, AI-powered code analysis and fixes without leaving the browser.

What People Can Use It For
Students learning to code — When error messages are confusing, CodeRescue explains bugs in plain English and shows the corrected code side-by-side

Junior developers — Get instant feedback on syntax errors, logic bugs, and anti-patterns before submitting code reviews

Interview preparation — Paste broken code examples and understand why they fail, learning debugging patterns

Quick code reviews — Rapidly validate small code snippets for common issues without setting up a full development environment

Cross-language debugging — CodeRescue auto-detects programming languages (Python, JavaScript, Java, C++, and more), so you don't need to specify what language you're working in

Challenges I ran into

Before CodeRescue With CodeRescue
Copy error → open StackOverflow → search → read multiple threads → try solutions Paste code → get fix in seconds
Manually compare buggy vs fixed code Side-by-side explanation with corrected code
Wonder if the fix is reliable Confidence score tells you how certain the AI is (high/medium/low)
Switch between IDE and browser constantly Single web interface, works on any device
Makes Code Safer By
Catching null pointer exceptions before they crash production

Identifying off-by-one errors that cause silent data corruption

Spotting memory leaks (C++) that degrade performance over time

Fixing async/await mistakes (JavaScript) that lead to race conditions

Flagging truncated code when input exceeds 1500 characters, preventing incomplete analysis

Key Differentiators
Auto language detection — No dropdown menus, just paste and go

Human-readable explanations — Describes bugs like you're explaining to a non-coder

Copy-to-clipboard — Fixed code is one click away from your IDE

No account required — Completely free and open access

Model choice — Switch between Gemma 3 12B (faster) and 27B (more accurate) based on your needs

Challenges I ran into
Challenge 1: Gemini API Returning Inconsistent JSON Formats
The Problem:
The Gemini API kept wrapping JSON responses in markdown code blocks (json ... ) or adding explanatory text before/after the JSON object. This broke the JSON parser completely, causing the app to fail silently.

How I Fixed It:
I implemented a multi-strategy JSON extraction system with 4 fallback layers:

python
def extract_json(raw: str) -> dict | None:
# Strategy 1: Direct parse
# Strategy 2: Strip markdown code blocks with regex
# Strategy 3: Regex extract JSON object pattern
# Strategy 4: Bracket-matching to find complete JSON block
This brute-force approach ensures that even if the AI misbehaves, the system still extracts valid JSON. I also set temperature=0 and top_k=1 to make the model as deterministic as possible.

Challenge 2: Handling Multiple AI Models Gracefully
The Problem:
When I added model switching between Gemma 3 12B and 27B, some models would fail to load while others succeeded. The app needed to handle partial model availability without crashing.

How I Fixed It:
I wrapped each model initialization in individual try-catch blocks and stored available models in a dictionary:

python
models = {}
for model_key, model_name in AVAILABLE_MODELS.items():
try:
models[model_key] = genai.GenerativeModel(model_name)
except Exception as e:
print(f"Error loading model {model_name}: {e}")
The API now dynamically falls back to any available model if the requested one isn't loaded, and the frontend shows only working models.

🏃 Challenge 3: Rate Limiting Without Blocking Legitimate Users
The Problem:
Without rate limiting, a single user could spam the API and exhaust quota. But overly aggressive limits would hurt the user experience.

How I Fixed It:
I implemented a 2-second cooldown per IP using an in-memory dictionary with timestamps. The 429 Too Many Requests response still returns a 200-like JSON body so the frontend can display a friendly message instead of crashing:

python
def is_rate_limited(ip: str) -> bool:
now = time()
if ip in _last_request and now - _last_request[ip] < 2:
return True
_last_request[ip] = now
return False
🌐 Challenge 4: CORS Issues Between GitHub Pages and Hugging Face
The Problem:
The frontend on GitHub Pages and backend on Hugging Face Spaces have different origins, causing CORS (Cross-Origin Resource Sharing) errors. Browsers blocked all API calls.

How I Fixed It:
I configured Flask-CORS to only allow the specific GitHub Pages domain, not wildcard origins:

python
allowed_origins = os.getenv("ALLOWED_ORIGINS", "https://sumit989bishnoi-crypto.github.io")
CORS(app, origins=allowed_origins.split(","))
On the frontend, I detect whether the app is running on GitHub Pages and dynamically switch between

Technologies used

Discussion

Builders also viewed

See more projects on Devfolio