http://imgur.com/a/lKI6Qc5
In the rules section I've defined a passing AppleScript as shown. It shows green, and I've defined the return value coming back as a new text attribute.
In the actions section, "randomstr" does show up as an option. When I run the action however I get this in the log:
2022-01-10 18:53:58.505 hazelworker[30640] s_foo_20220103-f2n3.png: Rule Foo matched.
2022-01-10 18:53:58.505 hazelworker[30640] Caught exception in rule evaluation of file s_foo_20220103-f2n3.png: [<HazelFileData 0x6000006a42c0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key hazelcustomtoken:randomstr.
2022-01-10 18:53:58.505 hazelworker[30640] ###main load address: 0x102148000
2022-01-10 18:53:58.505 hazelworker[30640] ###Hazel Core load address: 0x10227c000
2022-01-10 18:53:58.505 hazelworker[30640] ###Noodle load address: 0x1026c8000
2022-01-10 18:53:58.505 hazelworker[30640] ###CK load address: 0x10234c000
2022-01-10 18:53:58.505 hazelworker[30640] (
0 CoreFoundation 0x00000001b4b281cc __exceptionPreprocess + 240
1 libobjc.A.dylib 0x00000001b48797b8 objc_exception_throw + 60
2 CoreFoundation 0x00000001b4b52e24 _CFBundleGetValueForInfoKey + 0
3 Foundation 0x00000001b5ac35e0 -[NSObject(NSKeyValueCoding) valueForUndefinedKey:] + 236
4 HazelCore 0x000000010228ee50 hasNSRecords + 15508
5 Foundation 0x00000001b594aac0 -[NSObject(NSKeyValueCoding) valueForKey:] + 320
6 HazelCore 0x00000001022e1f74 _isDateValue + 53984
7 HazelCore 0x00000001022e1ffc _isDateValue + 54120
8 HazelCore 0x00000001022e8b6c _isDateValue + 81624
9 HazelCore 0x00000001022e852c _isDateValue + 80024
10 HazelCore 0x00000001022df4ac _isDateValue + 43032
11 HazelCore 0x00000001022e86c4 _isDateValue + 80432
12 HazelCore 0x00000001022df2ec _isDateValue + 42584
13 HazelCore 0x00000001022c5420 errorFromOSAScriptErrorDict + 171408
14 HazelCore 0x00000001022af070 errorFromOSAScriptErrorDict + 80352
15 hazelworker 0x0000000102150c04 hazelworker + 35844
16 hazelworker 0x00000001021534c0 hazelworker + 46272
17 hazelworker 0x0000000102155568 hazelworker + 54632
18 dyld 0x00000001023cd0f4 start + 520
I'm not following what I'm doing wrong that it is not key value coding compliant.