Skip to content

parse error: Invalid numeric literal at line 1, column 10 #17

@alexanderilyin

Description

@alexanderilyin

If you commit large text files, for example *.stl or *.step then API request to https://openrouter.ai could result in 500 and HTML instead of JSON in response:

> POST /api/v1/chat/completions HTTP/2
> Host: openrouter.ai
> user-agent: curl/7.88.1
> accept: */*
> authorization: ...
> content-type: application/json
> content-length: 86976212
...
< HTTP/2 503 
< date: Thu, 12 Dec 2024 12:36:20 GMT
< content-type: text/html; charset=UTF-8
< content-length: 4309
< x-frame-options: SAMEORIGIN
< referrer-policy: same-origin
< cache-control: private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0
< expires: Thu, 01 Jan 1970 00:00:01 GMT
< server: cloudflare
< cf-ray: 8f0dc256cdba2ef3-LAX

Which is this HTML:

<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en-US"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en-US"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en-US"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en-US"> <!--<![endif]-->
<head>
    <title>Worker exceeded resource limits | openrouter.ai | Cloudflare</title>
    <meta charset="UTF-8" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta name="robots" content="noindex, nofollow" />
    <meta name="viewport" content="width=device-width,initial-scale=1" />
    <link rel="stylesheet" id="cf_styles-css" href="/cdn-cgi/styles/cf.errors.css" />
    <!--[if lt IE 9]>
        <link rel="stylesheet" id='cf_styles-ie-css' href="/cdn-cgi/styles/cf.errors.ie.css" />
    <![endif]-->
    <style>
        body {
            margin: 0;
            padding: 0;
        }
    </style>
    <!--[if gte IE 10]><!-->
    <script>
        if (!navigator.cookieEnabled) {
            window.addEventListener('DOMContentLoaded', function () {
                var cookieEl = document.getElementById('cookie-alert');
                cookieEl.style.display = 'block';
            });
        }
    </script>
    <!--<![endif]-->
</head>
<body>
    <div id="cf-wrapper">
        <div class="cf-alert cf-alert-error cf-cookie-error" id="cookie-alert" data-translate="enable_cookies">
            Please enable cookies.
        </div>
        <div id="cf-error-details" class="cf-error-details-wrapper">
            <div class="cf-wrapper cf-header cf-error-overview">
                <h1>
                    <span class="cf-error-type" data-translate="error">Error</span>
                    <span class="cf-error-code">1102</span>
                    <small class="heading-ray-id">Ray ID: 8f0dba19c86e2a8e &bull; 2024-12-12 12:30:41 UTC</small>
                </h1>
                <h2 class="cf-subheadline" data-translate="error_desc">Worker exceeded resource limits</h2>
            </div>
            <!-- /.header -->
            <section></section>
            <!-- spacer -->
            <div class="cf-section cf-wrapper">
                <div class="cf-columns two">
                    <div class="cf-column">
                        <h2 data-translate="what_happened">What happened?</h2>
                        <p>
                            You've requested a page on a website
                            (<a href="https://www.cloudflare.com/5xx-error-landing/" target="_blank">Cloudflare</a>)
                            network. An unknown error occurred while rendering the page.
                        </p>
                    </div>
                    <div class="cf-column">
                        <h2 data-translate="what_can_i_do">What can I do?</h2>
                        <p>
                            <strong>If you are the owner of this website:</strong>
                            <br />
                            you should
                            <a href="https://www.cloudflare.com/login?utm_source=error_100x" target="_blank">login to
                                Cloudflare</a>
                            and check the error logs for openrouter.ai.
                        </p>
                    </div>
                </div>
            </div>
            <!-- /.section -->
            <div class="cf-error-footer cf-wrapper w-240 lg:w-full py-10 sm:py-4 sm:px-8 mx-auto text-center sm:text-left border-solid border-0 border-t border-gray-300">
                <p class="text-13">
                    <span class="cf-footer-item sm:block sm:mb-1">Cloudflare Ray ID:
                        <strong class="font-semibold">8f0dba19c86e2a8e</strong>
                    </span>
                    <span class="cf-footer-separator sm:hidden">&bull;</span>
                    <span id="cf-footer-item-ip" class="cf-footer-item hidden sm:block sm:mb-1">
                        Your IP:
                        <button type="button" id="cf-footer-ip-reveal" class="cf-footer-ip-reveal-btn">Click to reveal</button>
                        <span class="hidden" id="cf-footer-ip">104.48.82.165</span>
                        <span class="cf-footer-separator sm:hidden">&bull;</span>
                    </span>
                    <span class="cf-footer-item sm:block sm:mb-1">
                        <span>Performance &amp; security by</span>
                        <a rel="noopener noreferrer" href="https://www.cloudflare.com/5xx-error-landing" id="brand_link"
                            target="_blank">Cloudflare</a>
                    </span>
                </p>
                <script>
                    (function () {
                        function d() {
                            var b = a.getElementById("cf-footer-item-ip"),
                                c = a.getElementById("cf-footer-ip-reveal");
                            b && "classList" in b && (b.classList.remove("hidden"), c.addEventListener("click", function () {
                                c.classList.add("hidden");
                                a.getElementById("cf-footer-ip").classList.remove("hidden");
                            }));
                        }
                        var a = document;
                        document.addEventListener && a.addEventListener("DOMContentLoaded", d);
                    })();
                </script>
            </div>
            <!-- /.error-footer -->
        </div>
        <!-- /#cf-error-details -->
    </div>
    <!-- /#cf-wrapper -->
    <script>
        window._cf_translation = {};
    </script>
</body>
</html>

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions