utilities/auto-blog-link-preserver#23: Script run failures



Issue Information

Issue Type: issue
Status: closed
Reported By: btasker
Assigned To: btasker

Milestone: v0.2
Created: 27-Dec-25 08:36



Description

My k8s cronjob has started consistently erroring out.

$ kubectl logs anti-link-rot-29447040-v9gpf
https://www.bentasker.co.uk/posts/documentation/shooting/weihrauch-hw100-air-leak.html?utm_source=rss: f6be1e9b37cebd175da80efc6b38a55dbcac95f6
seen https://www.bentasker.co.uk/posts/documentation/shooting/weihrauch-hw100-air-leak.html?utm_source=rss
Traceback (most recent call last):
  File "/app/main.py", line 505, in <module>
    stats.append(process_feed(feed))
                 ^^^^^^^^^^^^^^^^^^
  File "/app/main.py", line 342, in process_feed
    page_status = submit_to_linkwarden(entry.link, tags)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/main.py", line 166, in submit_to_linkwarden
    LINKWARDEN_COLLECTION[1] = get_linkwarden_collection(LINKWARDEN_COLLECTION_NAME)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/main.py", line 105, in get_linkwarden_collection
    if name == c['name']:
               ~^^^^^^^^
TypeError: string indices must be integers, not 'str'

It was working as recently as 5th December.



Toggle State Changes

Activity


Lets take a look at the response

sudo tcpdump -i any -s0 -w linkwarden.pcap -v port 3000
kubectl create job antirot-manual --from=cronjob/anti-link-rot

Looks like it's an auth issue

Packet capture screenshot, shows we're getting a 401 back

Which is a little odd. The request clearly includes an auth header with a bearer token.

Looking in Linkwarden, the token's not expired:

image

I created a new one and updated the secret in k8s.

This time, it's run fine

https://www.bentasker.co.uk/posts/documentation/shooting/weihrauch-hw100-air-leak.html?utm_source=rss: f6be1e9b37cebd175da80efc6b38a55dbcac95f6
seen https://www.bentasker.co.uk/posts/documentation/shooting/weihrauch-hw100-air-leak.html?utm_source=rss
Found collection
https://www.bentasker.co.uk/posts/blog/general/playing-with-woodpecker-ci.html?utm_source=rss: 7519f26bd08a4ff26111085f6c70584c6a40a939
seen https://www.bentasker.co.uk/posts/blog/general/playing-with-woodpecker-ci.html?utm_source=rss
https://www.bentasker.co.uk/posts/blog/general/replacing-subsonic-with-gonic.html?utm_source=rss: 4344dc88799c9e9fb063bc2bd0d6bde1d738ef0d
Reached last seen entry
[{'feed_url': 'https://www.bentasker.co.uk/rss.xml', 'stats': {'entries': 2, 'links': 33, 'duplicates': 0, 'failed_submissions': 0, 'too_new': 0, 'runtime': 17297031574}, 'mean_submission_time': 529777955.8064516}]
Successfully submitted stats

We can obvs improve a bit here by having the code handle the auth failure, but it's not clear why the token suddenly stopped working.

verified

mentioned in commit 62f30b9d7a06eaa0bb2a92beb8c5c85cbdb2f04f

Commit: 62f30b9d7a06eaa0bb2a92beb8c5c85cbdb2f04f 
Author: B Tasker                            
                            
Date: 2025-12-27T10:22:01.000+00:00 

Message

fix: add status code handling to collection fetcher (utilities/auto-blog-link-preserver#23)

+5 -0 (5 lines changed)

assigned to @btasker