jsPsych / Behavioral experimentsRead · predict · build · inspect

Debugging and data checks

Start with the first error

Open the Console, clear old messages, refresh once, and read the first error. Later errors often follow from it. Keep the Network panel available for missing scripts and images. Change one thing at a time and rerun the smallest relevant case.

Symptom Likely cause Check
initJsPsych is not defined Core script missing or loaded too late HTML script path and order
Plugin variable undefined Plugin not loaded or wrong global name Match script filename with documented plugin class
Page shows [object Object] v8 placeholder inserted inside a function Use evaluateTimelineVariable inside the function
Every item looks identical Literal text or parameter computed too early Dynamic stimulus function and current item
Unexpected token Missing comma, quote, or brace First indicated line plus the preceding line
Image missing Wrong path or filename case Open asset URL directly; inspect preload result
Keys do nothing Wrong allowed keys, page lacks focus, deadline ended Click page, inspect choices, try again
Correct answer marked wrong Key mapping, type mismatch, or wrong answer key Hand-score one saved row
Practice never ends Cumulative data or unbounded loop Current attempt filter and maximum attempts
NaN on summary Empty eligible RT set Return N/A if no eligible trials
Results disappear on refresh Browser memory was not saved Use download controls before refresh
JATOS page remains local Wrong entry HTML or not launched from runner Use generated index-jatos.html through JATOS

Four-minute data audit

  1. Run a short pilot with one correct answer, one wrong answer, and one deliberate timeout.
  2. Filter to the task and block. Count trials independently from the stimulus list.
  3. For one row, reconstruct the expected response from the displayed stimulus and mapping. Do not use the saved correct_response field as the sole source of truth.
  4. Check that the omission has response: null, rt: null, and correct: false where accuracy is scored.
  5. Confirm the accuracy denominator includes all test trials. Confirm RT includes only correct, finite responses.
  6. Download CSV and JSON. Open both; check the final trial is present. Nested pointer data is easier to inspect in JSON.

Bug report template

A useful bug report describes an observation, not merely “it doesn’t work.” Keep identifying participant information out of examples.