SyntaxError: Unexpected token i in JSON at position 70



  • I'm getting this error message suddenly.

    The connection between the browser and your machine has been interrupted.
    Reason: Unknown (SyntaxError: Unexpected token i in JSON at position 70)
    Please reload the web interface to proceed.

    I click "Upload GCode files", the selection dialogue box pops up and I get the error message.

    I've restarted the printer and my browser.

    Any ideas?

    I was using the machine this morning, and it started throwing this message all the time when I try to upload a new GCode file.

    11:24:02 AMM122
    === Diagnostics ===
    RepRapFirmware for Duet 2 WiFi/Ethernet version 2.02(RTOS) running on Duet Ethernet 1.02 or later
    Board ID: 08DGM-95BLL-N6PSS-6JKD2-3S46Q-1JSRL
    Used output buffers: 3 of 20 (14 max)
    === RTOS ===
    Static ram: 25524
    Dynamic ram: 98264 of which 0 recycled
    Exception stack ram used: 392
    Never used ram: 6892
    Tasks: NETWORK(ready,544) HEAT(blocked,1232) MAIN(running,3844) IDLE(ready,200)
    Owned mutexes:
    === Platform ===
    Last reset 00:27:19 ago, cause: power up
    Last software reset at 2019-11-18 11:14, reason: User, spinning module GCodes, available RAM 6956 bytes (slot 3)
    Software reset code 0x0003 HFSR 0x00000000 CFSR 0x00000000 ICSR 0x0441f000 BFAR 0xe000ed38 SP 0xffffffff Task 0x4e49414d
    Error status: 0
    Free file entries: 10
    SD card 0 detected, interface speed: 20.0MBytes/sec
    SD card longest block write time: 35.1ms, max retries 0
    MCU temperature: min 18.1, current 20.8, max 21.6
    Supply voltage: min 12.9, current 13.1, max 13.2, under voltage events: 0, over voltage events: 0, power good: yes
    Driver 0: standstill, SG min/max 0/545
    Driver 1: standstill, SG min/max 0/553
    Driver 2: standstill, SG min/max 0/586
    Driver 3: standstill, SG min/max not available
    Driver 4: standstill, SG min/max not available
    Date/time: 2019-11-25 11:24:00
    Cache data hit count 3746190816
    Slowest loop: 235.55ms; fastest: 0.07ms
    I2C nak errors 0, send timeouts 0, receive timeouts 0, finishTimeouts 0
    === Move ===
    Hiccups: 0, StepErrors: 0, LaErrors: 0, FreeDm: 240, MinFreeDm: 237, MaxWait: 10802ms, Underruns: 0, 0
    Scheduled moves: 4, completed moves: 4
    Bed compensation in use: mesh
    Bed probe heights: 0.000 0.000 0.000 0.000 0.000
    === Heat ===
    Bed heaters = 0 -1 -1 -1, chamberHeaters = -1 -1
    Heater 1 is on, I-accum = 0.0
    === GCodes ===
    Segments left: 0
    Stack records: 2 allocated, 0 in use
    Movement lock held by null
    http is idle in state(s) 0
    telnet is idle in state(s) 0
    file is idle in state(s) 0
    serial is idle in state(s) 0
    aux is idle in state(s) 0
    daemon is idle in state(s) 0
    queue is idle in state(s) 0
    autopause is idle in state(s) 0
    Code queue is empty.
    === Network ===
    Slowest loop: 212.25ms; fastest: 0.02ms
    Responder states: HTTP(0) HTTP(0) HTTP(0) HTTP(0) FTP(0) Telnet(0) Telnet(0)
    HTTP sessions: 1 of 8
    Interface state 5, link 100Mbps full duplex



  • Maybe this will also help.

    (I'm not so much a JavaScript guy, so than you all for the help.)

    Error! The following JSON response could not be parsed: dwc.js:432
    {"err":0,"size":2596707,"lastModified":"2019-11-25T10:55:16","height":inf,"firstLayerHeight":0.00,"layerHeight":0.00,"filament":[],"generatedBy":""}

    It happens when I click on GCode Files tab and then enter the window with my mouse.



  • OK, it was a badly-formed GCode file.

    I used M20 to get the list of gfiles and M30 full.gcode to delete it.

    It seems like this could be improved to make the parser less sensitve to badly-formed GCode files.

    But anyway, I'm running again.


  • administrators

    I think it's the "height":inf that it didn't like (sadly, JSON doesn't recognise NaN or infinite floating point values). Do you still have a copy of that GCode file? If so, please make it available to us. I've just fixed the source code to avoid generating "inf" but it would be nice to have a file to test it on.



  • bad.gcode

    I'm printing right now, so I'm not sure this file will cause the failure.
    I can try in an hour or two.

    (Yes, it's a REAL BAD FILE. I need to not go through the edit/compile/run/print steps quite so quickly. 🙂 )



  • Yeah, bad.gcode causes the problem.

    (And, PLEASE, it's a real bad file, I realize it.)

    So if it's impossible to parse, it's not your problem, it's mine for creating such a monster in the first place.

    😞


  • administrators

    Thanks. I've used that file to verify that the fix works. And it's not your problem, it mine; because one of my principles is that software should behave reasonably whatever input you throw at it. If everyone took this attitude, there would be far fewer security vulnerabilities in released software.


Log in to reply