Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get the number of an unknown enum value #85

Open
HarrisonQi opened this issue Dec 17, 2020 · 4 comments
Open

Can't get the number of an unknown enum value #85

HarrisonQi opened this issue Dec 17, 2020 · 4 comments

Comments

@HarrisonQi
Copy link

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)
@xy9860
Copy link

xy9860 commented Dec 26, 2020

我的错误和你相同,并且node版本能正常运行

@huan
Copy link
Member

huan commented Dec 26, 2020

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!

@koreQAQ
Copy link

koreQAQ commented Mar 6, 2022

上述问题依然存在,node 版本运行正常

@chenzhiqiang0518
Copy link

@HarrisonQi 你的wechaty使用在企微场景下的吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants