iv-org / invidious

Invidious is an alternative front-end to YouTube
https://invidious.io
GNU Affero General Public License v3.0
16.23k stars 1.79k forks source link

[Bug] Search failure: Invalid Int32: "@SomeUsername" #3394

Closed deriv closed 1 year ago

deriv commented 1 year ago

Describe the bug I was searching for content, and instead of seeing results of the search, invidious reported a bug being found.

Steps to Reproduce I was not able to reproduce the error. It was the very first time ever seeing such an issue with any Invidious-instance.

Logs

Title: Invalid Int32: "@RealLifeLore" (ArgumentError) Date: 2022-11-15T11:51:52Z Route: /search?q=reallifelore Version: 2022.11.02-09942de @ master

Backtrace

``` Invalid Int32: "@RealLifeLore" (ArgumentError) from /usr/share/crystal/src/int.cr:957:11 in 'to_i32' from /usr/share/crystal/src/string.cr:333:5 in 'short_text_to_number' from src/invidious/yt_backend/extractors.cr:173:20 in 'process' from src/invidious/yt_backend/extractors.cr:707:17 in 'extract_item' from src/invidious/yt_backend/extractors.cr:738:28 in 'extract_items' from src/invidious/search/processors.cr:12:14 in 'process' from src/invidious/routes/search.cr:55:18 in 'search' from src/invidious/helpers/handlers.cr:30:37 in 'call' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call_next' from lib/kemal/src/kemal/filter_handler.cr:21:7 in 'call' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call_next' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call_next' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call_next' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call_next' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call_next' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call_next' from lib/kemal/src/kemal/init_handler.cr:12:7 in 'process' from /usr/share/crystal/src/http/server.cr:500:5 in '->' from /usr/share/crystal/src/fiber.cr:146:11 in 'run' from ??? ```

Screenshots

Additional context

Browser: Firefox 106.0.5 Instance: https://invidious.namazso.eu

tirz commented 1 year ago

Title: Invalid Int32: "@LowkoTV" (ArgumentError) Date: 2022-11-16T22:21:35Z Route: /search?q=lowko Version: 2022.10.25-0c7919f @ master

Backtrace

``` Invalid Int32: "@LowkoTV" (ArgumentError) from /usr/lib/crystal/core/int.cr:957:11 in 'to_i32' from /usr/lib/crystal/core/string.cr:333:5 in 'short_text_to_number' from /invidious/src/invidious/yt_backend/extractors.cr:172:20 in 'process' from /invidious/src/invidious/yt_backend/extractors.cr:615:17 in 'extract_item' from /invidious/src/invidious/yt_backend/extractors.cr:646:28 in 'extract_items' from /invidious/src/invidious/search/processors.cr:12:14 in 'process' from /invidious/src/invidious/routes/search.cr:55:18 in 'search' from /invidious/src/invidious/helpers/handlers.cr:30:37 in 'call' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call_next' from /invidious/lib/kemal/src/kemal/filter_handler.cr:21:7 in 'call' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call_next' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call_next' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call_next' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call_next' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call_next' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call_next' from /invidious/lib/kemal/src/kemal/init_handler.cr:12:7 in 'process' from /usr/lib/crystal/core/http/server.cr:500:5 in '->' from /usr/lib/crystal/core/fiber.cr:146:11 in 'run' from ??? ```

I think I had the same bug. It seems to be triggered while parsing the link to a channel (and not by the list of videos).

SamantazFox commented 1 year ago

Thanks for the report! Though, I'm unable to reproduce... Maybe some Youtube A/B testing?

tempname1024 commented 1 year ago

Title: Invalid Int32: "@ThenNow" (ArgumentError) Date: 2022-11-18T09:56:42Z Route: /search?q=then+and+now Version: 2022.11.17-516efd2d @ master

Backtrace

``` Invalid Int32: "@ThenNow" (ArgumentError) from /usr/lib/crystal/core/int.cr:957:11 in 'to_i32' from /usr/lib/crystal/core/string.cr:333:5 in 'short_text_to_number' from src/invidious/yt_backend/extractors.cr:173:20 in 'process' from src/invidious/yt_backend/extractors.cr:707:17 in 'extract_item' from src/invidious/yt_backend/extractors.cr:738:28 in 'extract_items' from src/invidious/search/processors.cr:12:14 in 'process' from src/invidious/routes/search.cr:55:18 in 'search' from src/invidious/helpers/handlers.cr:30:37 in 'call' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call_next' from lib/kemal/src/kemal/filter_handler.cr:21:7 in 'call' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call_next' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call_next' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call_next' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call_next' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call_next' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call_next' from lib/kemal/src/kemal/init_handler.cr:12:7 in 'process' from /usr/lib/crystal/core/http/server.cr:500:5 in '->' from /usr/lib/crystal/core/fiber.cr:146:11 in 'run' from ??? ```

Ran into this today as well, resolved upon refresh.

manu-cyber commented 1 year ago

I encountered the same bug when searching for colelangs. I found that it was reproducible about 30-40% of the times I tried, the instance I use is iv.catgirl.cloud (for quickly reproducing maybe). The term searched doesn’t seem to matter.

Title: Invalid Int32: "@ColeLangs" (ArgumentError) Date: 2022-11-19T08:09:30Z Route: /search?q=colelangs Version: 2022.11.02-09942dee @ master

Backtrace

``` Invalid Int32: "@ColeLangs" (ArgumentError) from /usr/share/crystal/src/string.cr:432:5 in 'to_i32' from /usr/share/crystal/src/string.cr:333:5 in 'to_i' from src/invidious/helpers/utils.cr:176:12 in 'short_text_to_number' from src/invidious/yt_backend/extractors.cr:173:20 in 'parse' from src/invidious/yt_backend/extractors.cr:159:16 in 'process' from src/invidious/yt_backend/extractors.cr:707:17 in 'extract_item' from src/invidious/yt_backend/extractors.cr:738:28 in 'extract_items' from src/invidious/search/processors.cr:12:14 in 'regular' from src/invidious/search/query.cr:116:30 in 'process' from src/invidious/routes/search.cr:55:18 in 'search' from src/invidious/routing.cr:162:20 in '->' from lib/kemal/src/kemal/route.cr:12:26 in '->' from src/invidious/helpers/handlers.cr:30:37 in 'process_request' from lib/kemal/src/kemal/route_handler.cr:17:7 in 'call' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call_next' from lib/kemal/src/kemal/websocket_handler.cr:13:14 in 'call' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call_next' from lib/kemal/src/kemal/filter_handler.cr:21:7 in 'call' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call_next' from src/invidious/helpers/handlers.cr:212:5 in 'call' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call_next' from src/invidious/helpers/handlers.cr:94:12 in 'call' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call_next' from src/invidious/helpers/handlers.cr:145:12 in 'call' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call_next' from src/invidious/helpers/handlers.cr:70:5 in 'call' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call_next' from src/ext/kemal_static_file_handler.cr:162:16 in 'call' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call_next' from lib/kemal/src/kemal/exception_handler.cr:8:7 in 'call' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call_next' from src/invidious/helpers/logger.cr:17:35 in 'call' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call_next' from lib/kemal/src/kemal/init_handler.cr:12:7 in 'call' from /usr/share/crystal/src/http/server/request_processor.cr:51:11 in 'process' from /usr/share/crystal/src/http/server.cr:515:5 in 'handle_client' from /usr/share/crystal/src/http/server.cr:468:13 in '->' from /usr/share/crystal/src/fiber.cr:146:11 in 'run' from /usr/share/crystal/src/fiber.cr:98:34 in '->' from ??? ```

SamantazFox commented 1 year ago

Yay, I managed to get a faulty search repeatedly, and to extract the JSON!

Here is what a normal reponse should look like:

"channelRenderer": {
  "channelId": "UCLam0sFSS0qA_DXGXsn8YGA",
  "title": { "simpleText": "AERO CHORD" },
  "videoCountText": {
    "runs": [
      {
        "text": "76"
      },
      {
        "text": " videos"
      }
    ]
  },
  "subscriptionButton": {
    "subscribed": false
  },
  "subscriberCountText": {
    "accessibility": {
      "accessibilityData": {
        "label": "116K subscribers"
      }
    },
    "simpleText": "116K subscribers"
  }
}

Here's what a faulty one looks like:

"channelRenderer": {
  "channelId": "UCLam0sFSS0qA_DXGXsn8YGA",
  "title": { "simpleText": "AERO CHORD" },
  "videoCountText": {
    "accessibility": {
      "accessibilityData": {
        "label": "116K subscribers"
      }
    },
    "simpleText": "116K subscribers"
  },
  "subscriptionButton": {
    "subscribed": false
  },
  "subscriberCountText": {
    "simpleText": "@TheAeroChord"
  }
}

Thank youtube for that! Yoou're so well coded :rofl:

fogti commented 1 year ago

Can the search be made a bit more tolerant regarding malformed search entries, such that all parsable entries get returned, and a option is presented to report the unparsable ones (preferably including their raw content to figure out what's wrong)?

Or alternatively displaying a placeholder in the web interface for the parts that couldn't be parsed?

dragnev-dev commented 1 year ago

Keep getting the error in the last 45 mins with different search strings. Search completely unusable.

EDIT: OK apparently it was temporary as later that night search worked for me. Right now, 12H later it just works EDIT 2: after a couple more searches it broke again

piquark6046 commented 1 year ago

Title: Invalid Int32: "@komq" (ArgumentError) Date: 2022-11-20T10:27:35Z Route: /search?q=%EC%BD%94%EB%A7%88 Version: 2022.11.17-e726eaf @ master

Backtrace

``` Invalid Int32: "@komq" (ArgumentError) from /usr/lib/crystal/core/int.cr:957:11 in 'to_i32' from src/invidious/helpers/utils.cr:176:3 in 'short_text_to_number' from src/invidious/yt_backend/extractors.cr:173:20 in 'process' from src/invidious/yt_backend/extractors.cr:707:17 in 'extract_item' from src/invidious/yt_backend/extractors.cr:738:28 in 'extract_items' from src/invidious/search/processors.cr:12:14 in 'process' from src/invidious/routes/search.cr:56:7 in 'search' from lib/kemal/src/kemal/config.cr:92:7 in 'call' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call_next' from lib/kemal/src/kemal/filter_handler.cr:21:7 in 'call' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call_next' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call_next' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call_next' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call_next' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call_next' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call_next' from lib/kemal/src/kemal/init_handler.cr:12:7 in 'process' from /usr/lib/crystal/core/http/server.cr:500:5 in '->' from /usr/lib/crystal/core/fiber.cr:146:11 in 'run' from /src/boringssl/src/google-boringssl-251b516/ssl/internal.h:334:8 in '??' ```

SamantazFox commented 1 year ago

Yup, it's utterly inconsistent (Thanks YT). but at least, I've a quick fix done:

image image

SamantazFox commented 1 year ago

It looks like they're repurposing the fields to change what's displayed in the search results without having to change other code (like client JS)? image

Though, it seems that the results on YT are very consistent (by that I mean "always broken", i.e VideoCountText has the number of subs and subscriberCountText has the handle).

GageeGh0stt commented 1 year ago

I'm having this issue as well! :( I was trying to look up my favorite music artist today and it gave me this message. I hope it can be fixed soon! No pressure tho! :)))

image

https://youtube.076.ne.jp

alejandroandreu commented 1 year ago

Not sure if relevant, but I'll add this happens on my RPi instance and NOT on some public instances. Therefore, I think it might be related to the arm64 architecture?

unixfox commented 1 year ago

It happens on all the invidious instances, whenever they are running arm64 or not.

fogti commented 1 year ago

@alejandroandreu https://github.com/iv-org/invidious/issues/3394#issuecomment-1321261688 it's just youtube search results are seemingly getting fudged to avoid messing with the frontend youtube code, but which impacts other frontends which then can't easily parse the results anymore.

pH142857 commented 1 year ago

Same bug I think:

Title: Invalid Int32: "@ScienceEtonnante" (ArgumentError) Date: 2022-12-22T21:52:41Z Route: /search?q=science+%C3%A9tonnante Version: 2022.11.17-516efd2d @ master

Backtrace

``` Invalid Int32: "@ScienceEtonnante" (ArgumentError) from /usr/share/crystal/src/string.cr:422:83 in 'to_i32' from src/invidious/yt_backend/extractors.cr:172:26 in 'process' from src/invidious/yt_backend/extractors.cr:707:17 in 'extract_item' from src/invidious/yt_backend/extractors.cr:738:28 in 'extract_items' from src/invidious/search/processors.cr:12:14 in 'process' from src/invidious/routes/search.cr:55:18 in 'search' from src/invidious/helpers/handlers.cr:30:37 in 'call' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call_next' from lib/kemal/src/kemal/filter_handler.cr:21:7 in 'call' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call_next' from src/invidious/helpers/handlers.cr:94:12 in 'call' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call_next' from src/invidious/helpers/handlers.cr:151:29 in 'call' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call_next' from src/ext/kemal_static_file_handler.cr:106:36 in 'call' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call' from /usr/share/crystal/src/http/server/request_processor.cr:51:11 in 'process' from /usr/share/crystal/src/http/server.cr:500:5 in '->' from /usr/share/crystal/src/fiber.cr:146:11 in 'run' from ??? ```

alejandroandreu commented 1 year ago

You're totally right @unixfox . I arrived to that conclusion since I couldn't reproduce this issue in many public instances. Then I realized what was different on my end: Docker image with tag latest-arm64 has an older version of Invidious than latest.

I then proceeded to build the Docker image myself on my Raspberry Pi with the following command (on master):

sudo docker build -f docker/Dockerfile.arm64 --build-arg release=1 --build-arg disable_quic=1 .

My Invidious version is now: 2022.11.22-5160d8ba @ master

Search queries that would make Invidious break before are now working. The issue might not be completely resolved in this version, but at least it fixed the issues I was personally facing.


EDIT: Query mentioned above by @pH142857 is working on my instance :smile:

unixfox commented 1 year ago

You're totally right @unixfox . I arrived to that conclusion since I couldn't reproduce this issue in many public instances. Then I realized what was different on my end: Docker image with tag latest-arm64 has an older version of Invidious than latest.

That's not true, latest-arm64 is at the same version of the tag latest: image

source: https://quay.io/repository/invidious/invidious?tab=tags

Search queries that would make Invidious break before are now working. The issue might not be completely resolved in this version, but at least it fixed the issues I was personally facing.

Please take my word for it, like I said in https://github.com/iv-org/invidious/issues/3394#issuecomment-1359117371, this is issue IS NOT architecture dependent. It happens on all the docker images of invidious. It's just random.

mk-pmb commented 1 year ago

Is this bug about the new URL "at username" style for user channel URLs, like https://yewtu.be/@Jules1 ? Or should I open a new feature request for their support?

SamantazFox commented 1 year ago

@mk-pmb This issue is about the Invalid Int32 error on the search page.

For the support of .../@username URLs, please see #3358.

DUOLabs333 commented 1 year ago

This issue seems to be superseded by #3460 (this no longer happens to me).

SamantazFox commented 1 year ago

Closing, as the problem was fixed