# [Bug] Lesson submission fails with “400 OK” error in JavaScript Playground #280

Closed
opened 2026-06-28 15:25:08 +00:00 by enjin2310 · 1 comment

Summary

While attempting to submit a correct solution in the JavaScript Playground, the server returns a 400 OK error, preventing code execution. The issue persists across multiple attempts, even after refreshing and clearing cache.

Issue Description

In Lesson 300 – if y else (and every JS lesson) , the user writes the correct code according to the lesson instructions. Upon clicking Enviar, the platform fails to send the code for execution and displays the error message:

Error: No se pudo enviar el código de la lección para ejecutar

The browser console reveals a HTTP 400 OK response from the backend API, indicating a validation failure. The error message suggests a mismatch between the lesson type and the API endpoint being called.

Console Output

Failed to submit lesson:
Object { headers: {}, status: 400, statusText: "OK", url: "https://api.spikersoft.com/api/CSharpCodeRunner/lesson", ok: false, ... }
error: Object { type: "https://tools.ietf.org/html/rfc7231#section-6.5.1", title: "One or more validation errors occurred.", status: 400, ... }
detail: "Code has syntax errors: Identifier expected"
errors: Object { code: (1) […] }
status: 400
timestamp: "2026-06-28T15:17:26.8344337Z"
title: "One or more validation errors occurred."
traceId: "0HNML4PB6767O:00000031"

Observations

  • The API endpoint used is CSharpCodeRunner, even though the lesson is a JavaScript lesson.
  • The error message “Identifier expected” is misleading because the submitted JavaScript code is syntactically correct.
  • The issue persists after multiple retries, hard refresh, and cache clearing.

Environment

Property Value
Application SpikerSoft Learning Platform
Module JavaScript Playground
Lesson 300 – if y else
Environment Production
Browser Firefox
Operating System Windows 11
Version v2026.06.22b
Device Desktop PC

Preconditions

User is logged in and has access to the JavaScript Playground.

Steps to Reproduce

  1. Navigate to learn.spikersoft.com/tools/javascript-playground?lessonId=30300.
  2. Write the following code:
    function temperatureLabel(degreesC) {
        if (degreesC >= 30) {
            return "hot";
        } else if (degreesC <= 10) {
            return "cold";
        } else {
            return "mild";
        }
    }
    

Steps to Reproduce

  1. Click Enviar to submit the code.
  2. Observe the error message and console output.

Expected Result

The code should be submitted successfully, executed, and validated against the lesson test cases.

Actual Result

Submission fails with a 400 OK error and message:

“No se pudo enviar el código de la lección para ejecutar.”

Evidence

  • Screenshot 1: Playground interface showing the error message.
  • Screenshot 2: Developer console showing the 400 OK response and validation error details.

Impact

  • Prevents lesson progression and code validation.
  • Affects all users attempting to complete Lessons.
  • Creates confusion due to misleading error message (“Identifier expected”).

Frequency

Always

Reproducibility

100%

Severity

High

Notes

Also, while at Local mode lesson works fine and code submitted succesfully

## Summary While attempting to submit a correct solution in the **JavaScript Playground**, the server returns a **400 OK** error, preventing code execution. The issue persists across multiple attempts, even after refreshing and clearing cache. ## Issue Description In **Lesson 300 – if y else** (and every JS lesson) , the user writes the correct code according to the lesson instructions. Upon clicking **Enviar**, the platform fails to send the code for execution and displays the error message: > **Error:** No se pudo enviar el código de la lección para ejecutar The browser console reveals a **HTTP 400 OK** response from the backend API, indicating a validation failure. The error message suggests a mismatch between the lesson type and the API endpoint being called. ### Console Output Failed to submit lesson: Object { headers: {}, status: 400, statusText: "OK", url: "https://api.spikersoft.com/api/CSharpCodeRunner/lesson", ok: false, ... } error: Object { type: "https://tools.ietf.org/html/rfc7231#section-6.5.1", title: "One or more validation errors occurred.", status: 400, ... } detail: "Code has syntax errors: Identifier expected" errors: Object { code: (1) […] } status: 400 timestamp: "2026-06-28T15:17:26.8344337Z" title: "One or more validation errors occurred." traceId: "0HNML4PB6767O:00000031" ### Observations - The API endpoint used is **CSharpCodeRunner**, even though the lesson is a **JavaScript** lesson. - The error message “Identifier expected” is misleading because the submitted JavaScript code is syntactically correct. - The issue persists after multiple retries, hard refresh, and cache clearing. ## Environment | Property | Value | |-----------|--------| | Application | SpikerSoft Learning Platform | | Module | JavaScript Playground | | Lesson | 300 – if y else | | Environment | Production | | Browser | Firefox | | Operating System | Windows 11 | | Version | v2026.06.22b | | Device | Desktop PC | ## Preconditions User is logged in and has access to the JavaScript Playground. ## Steps to Reproduce 1. Navigate to `learn.spikersoft.com/tools/javascript-playground?lessonId=30300`. 2. Write the following code: ```javascript function temperatureLabel(degreesC) { if (degreesC >= 30) { return "hot"; } else if (degreesC <= 10) { return "cold"; } else { return "mild"; } } ## Steps to Reproduce 1. Click **Enviar** to submit the code. 2. Observe the error message and console output. 3. ## Expected Result The code should be submitted successfully, executed, and validated against the lesson test cases. ## Actual Result Submission fails with a **400 OK** error and message: > *“No se pudo enviar el código de la lección para ejecutar.”* ## Evidence - **Screenshot 1:** Playground interface showing the error message. - **Screenshot 2:** Developer console showing the **400 OK** response and validation error details. ## Impact - Prevents lesson progression and code validation. - Affects all users attempting to complete Lessons. - Creates confusion due to misleading error message (“Identifier expected”). ## Frequency Always ## Reproducibility 100% ## Severity High ## Notes Also, while at Local mode lesson works fine and code submitted succesfully
Owner

Resolved in spikersoft-backend PR #33 (merged to master). Root cause: the shared CSharpCodeRunnerController was hardcoding metadata.language = "csharp", so valid JavaScript/Python lesson submissions were run through the C# Roslyn validator and rejected with the misleading 400 "Code has syntax errors: Identifier expected". The controller now preserves the client-supplied language (defaulting to csharp only when absent) on both the run and lesson endpoints. Closing.

Follow-up #285 tracks renaming the controller to a language-agnostic name to prevent this class of regression.

Resolved in spikersoft-backend PR #33 (merged to `master`). Root cause: the shared `CSharpCodeRunnerController` was hardcoding `metadata.language = "csharp"`, so valid JavaScript/Python lesson submissions were run through the C# Roslyn validator and rejected with the misleading `400 "Code has syntax errors: Identifier expected"`. The controller now preserves the client-supplied language (defaulting to `csharp` only when absent) on both the `run` and `lesson` endpoints. Closing. Follow-up #285 tracks renaming the controller to a language-agnostic name to prevent this class of regression.
Sign in to join this conversation.