java-wechaty
java-wechaty copied to clipboard
Can't get the number of an unknown enum value
token是申请的15天的token. 企业微信版本. 扫码成功后报错. 求教各位大神我该如何处理该问题呢? 我该如何修复呢?
代码:
class Bot{
public static void main(String args[]){
final String token = System.getenv("WECHATY_PUPPET_HOSTIE_TOKEN");
Wechaty bot = Wechaty.instance(token)
.onScan((qrcode, statusScanStatus, data) -> System.out.println(QrcodeUtils.getQr(qrcode)))
.onLogin(user -> System.out.println("User logined :" + user))
.onMessage(message -> System.out.println("Message:" + message))
.start(true);
}
}
使用版本:
<dependency>
<groupId>io.github.wechaty</groupId>
<artifactId>wechaty</artifactId>
<version>0.1.5-SNAPSHOT</version>
</dependency>
运行出现:
Can't get the number of an unknown enum value.
完整日志:
Exception in thread "pool-10-thread-7" java.lang.Error: java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Can't get the number of an unknown enum value.
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1155)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Can't get the number of an unknown enum value.
at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1908)
at io.github.wechaty.Puppet.contactPayload(Puppet.kt:517)
at io.github.wechaty.user.Contact.ready(Contact.kt:84)
at io.github.wechaty.user.Contact.ready$default(Contact.kt:76)
at io.github.wechaty.Wechaty$initPuppetEventBridge$$inlined$forEach$lambda$5.handler(Wechaty.kt:260)
at io.github.wechaty.Puppet$on$10.handler(Puppet.kt:241)
at io.github.wechaty.eventEmitter.EventEmitter$emit$$inlined$forEach$lambda$1.run(EventEmitter.kt:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
... 2 more
Caused by: java.lang.IllegalArgumentException: Can't get the number of an unknown enum value.
at io.github.wechaty.grpc.puppet.Contact$ContactType.getNumber(Contact.java:170)
at io.github.wechaty.grpc.GrpcPuppet$contactRawPayload$1.get(GrpcPuppet.kt:410)
at io.github.wechaty.grpc.GrpcPuppet$contactRawPayload$1.get(GrpcPuppet.kt:29)
at java.util.concurrent.CompletableFuture$AsyncSupply.run$$$capture(CompletableFuture.java:1604)
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java)
at java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1596)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:172)
我的错误和你相同,并且node版本能正常运行
When using the Java Wechaty, it's no difference whether you are using a donut token or a wxwork token because they all are provided by the Wechaty Puppet Service and implemented by our gRPC interface.
Please feel free to dive into the code to catch the problem, if you can, and more discussion and PR are all welcome!
上述问题依然存在,node 版本运行正常
@HarrisonQi 你的wechaty使用在企微场景下的吗?