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

Message do not sended. [400] Bad Request: can't parse entities #33

Open
kksudo opened this issue Oct 24, 2018 · 7 comments
Open

Message do not sended. [400] Bad Request: can't parse entities #33

kksudo opened this issue Oct 24, 2018 · 7 comments

Comments

@kksudo
Copy link

kksudo commented Oct 24, 2018

I get error Jenkins log all.
Message do not sended.
I'm not use mardown, simple Letter and number, like Version = ${version_parametr}, in log job i see Version = 123, but in log jenkins i see next error:
org.telegram.telegrambots.exceptions.TelegramApiRequestException: Error sending message: [400] Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 133 at org.telegram.telegrambots.api.methods.send.SendMessage.deserializeResponse(SendMessage.java:170) at org.telegram.telegrambots.api.methods.send.SendMessage.deserializeResponse(SendMessage.java:24) at jenkinsci.plugins.telegrambot.telegram.TelegramBot.sendApiMethodWithProxy(TelegramBot.java:222) at jenkinsci.plugins.telegrambot.telegram.TelegramBot.execute(TelegramBot.java:153) at jenkinsci.plugins.telegrambot.telegram.TelegramBot.sendMessage(TelegramBot.java:80) at jenkinsci.plugins.telegrambot.telegram.TelegramBot.lambda$sendMessage$0(TelegramBot.java:102) at java.lang.Iterable.forEach(Iterable.java:75) at jenkinsci.plugins.telegrambot.telegram.TelegramBot.sendMessage(TelegramBot.java:102) at jenkinsci.plugins.telegrambot.TelegramBotBuilder.perform(TelegramBotBuilder.java:63) at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:81) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744) at hudson.model.Build$BuildExecution.build(Build.java:206) at hudson.model.Build$BuildExecution.doRun(Build.java:163) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504) at hudson.model.Run.execute(Run.java:1810) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:429)

@nikitabelonogov
Copy link

Hi @mausspb

How do you set version_parametr in build environment?

@kksudo
Copy link
Author

kksudo commented Oct 24, 2018

test/deafult_build

@kksudo
Copy link
Author

kksudo commented Oct 24, 2018

I think troubl was from whitespace in end of line in the body

@kksudo kksudo closed this as completed Oct 25, 2018
@kksudo kksudo reopened this Oct 26, 2018
@kksudo
Copy link
Author

kksudo commented Oct 26, 2018

Bug reproduced again with other data ....
Jenkins log, version 1.2.1


########################
   App               :: *app*
   Env                :: stage_app
   Status build :: *SUCCESS* ✅
########################

Git commit id      :: b0a42b5f
Git commit desc :: Y1-000

Job Name          :: experiments/Auth
Job id jenkins    :: 001
org.telegram.telegrambots.exceptions.TelegramApiRequestException: Error sending message: [400] Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 84
	at org.telegram.telegrambots.api.methods.send.SendMessage.deserializeResponse(SendMessage.java:170)
	at org.telegram.telegrambots.api.methods.send.SendMessage.deserializeResponse(SendMessage.java:24)
	at jenkinsci.plugins.telegrambot.telegram.TelegramBot.sendApiMethodWithProxy(TelegramBot.java:222)
	at jenkinsci.plugins.telegrambot.telegram.TelegramBot.execute(TelegramBot.java:153)
	at jenkinsci.plugins.telegrambot.telegram.TelegramBot.sendMessage(TelegramBot.java:80)
	at jenkinsci.plugins.telegrambot.telegram.TelegramBot.lambda$sendMessage$0(TelegramBot.java:102)
	at java.lang.Iterable.forEach(Iterable.java:75)
	at jenkinsci.plugins.telegrambot.telegram.TelegramBot.sendMessage(TelegramBot.java:102)
	at jenkinsci.plugins.telegrambot.TelegramBotBuilder.perform(TelegramBotBuilder.java:63)
	at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:81)
	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
	at hudson.model.Build$BuildExecution.build(Build.java:206)
	at hudson.model.Build$BuildExecution.doRun(Build.java:163)
	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
	at hudson.model.Run.execute(Run.java:1810)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
	at hudson.model.ResourceController.execute(ResourceController.java:97)
	at hudson.model.Executor.run(Executor.java:429)

@kksudo
Copy link
Author

kksudo commented Oct 26, 2018

I found problem here, with again - markdown. May be you implement the code for check in markdown ? Or this is already implements in new version?

@tidylobster
Copy link

@mausspb Indeed it's a bug with Markdown parsing. In your message it's probably triggering to the underscore char "_". I've escaped it with 2 leading slashes and everything worked out, e.g. my\\_app has been successfully built. Here's Python's code, that will work for every case.

@zerthimon
Copy link

This is happening because of underscore char.
What if you cannot escape it, for example when it comes in a variable, such as ${RUN_DISPLAY_URL} ?
The plugin needs to add a way to handle this!

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

4 participants