Closed
Description
Describe the bug
When trying docs-builder serv
using the commit at 05680a5, if I click on the docs link for Functions and operators
, the page does not load, and in the console running docs-builder I get the error:
Error: length ('-1') must be a non-negative value. (Parameter 'length')
Resetting back two commits to bd6fd6c fixes the issue, so one of the two commits above that introduced this bug. The relevant PRs are Optimize HJLS
and Fix relative links
.
The full stack trace is:
error::d.b.h.mentationWebHost:: Request Details - Method: GET, Path: /reference/query-languages/esql/esql-functions-operators, QueryString:
fail ::d.b.h.mentationWebHost:: Error handler failed to process exception. Handler Error: Object reference not set to an instance of an object.
Stack Trace: at Westwind.AspNetCore.LiveReload.ResponseStreamWrapper.FlushAsync(CancellationToken) + 0xf8
at Microsoft.AspNetCore.Http.HttpResponseWritingExtensions.WriteAsync(HttpResponse, String, Encoding, CancellationToken) + 0xc4
at Documentation.Builder.Http.DocumentationWebHost.<>c.<<SetUpRoutes>b__6_3>d.MoveNext() + 0x4a0
error::m.a.d.andlerMiddleware:: An exception was thrown attempting to execute the error handler.
error::m.a.s.Kestrel :: Connection id "0HNBDRD8IHA59", Request id "0HNBDRD8IHA59:0000000A": An unhandled exception was thrown by the application.
error::m.a.d.andlerMiddleware:: An unhandled exception has occurred while executing the request.
error::d.b.h.mentationWebHost:: Unhandled exception processing request /reference/query-languages/esql/esql-functions-operators. Error: length ('-1') must be a non-negative value. (Parameter 'length')
Actual value was -1.
Stack Trace: at System.ArgumentOutOfRangeException.ThrowNegative[T](T, String) + 0x80
at System.ArgumentOutOfRangeException.ThrowIfNegative[T](T, String) + 0x18
at System.String.ThrowSubstringArgumentOutOfRange(Int32, Int32) + 0x2c
at System.String.Substring(Int32, Int32) + 0x50
at Elastic.Markdown.Myst.InlineParsers.DiagnosticLinkInlineParser.UpdateLinkUrl(LinkInline, String, ParserContext, String) + 0x104
at Elastic.Markdown.Myst.InlineParsers.DiagnosticLinkInlineParser.ProcessInternalLink(LinkInline, InlineProcessor, ParserContext) + 0x374
at Elastic.Markdown.Myst.InlineParsers.DiagnosticLinkInlineParser.ValidateAndProcessLink(LinkInline, InlineProcessor, ParserContext) + 0x144
at Elastic.Markdown.Myst.InlineParsers.DiagnosticLinkInlineParser.Match(InlineProcessor, StringSlice&) + 0x84
at Markdig.Parsers.InlineProcessor.ProcessInlineLeaf(LeafBlock) + 0x1a8
at Markdig.Parsers.MarkdownParser.ProcessInlines(InlineProcessor, MarkdownDocument) + 0x1e8
at Markdig.Parsers.MarkdownParser.Parse(String, MarkdownPipeline, MarkdownParserContext) + 0x1a4
at Elastic.Markdown.Myst.MarkdownParser.<ParseAsync>d__13.MoveNext() + 0x3d4
--- End of stack trace from previous location ---
at Elastic.Markdown.Myst.MarkdownParser.<ParseAsync>d__13.MoveNext() + 0x51c
--- End of stack trace from previous location ---
at Elastic.Markdown.Myst.Directives.DirectiveHtmlRenderer.WriteIncludeBlock(HtmlRenderer, IncludeBlock, MarkdownParser) + 0x88
at Markdig.Renderers.RendererBase.Write(MarkdownObject) + 0xf4
at Markdig.Renderers.RendererBase.WriteChildren(ContainerBlock) + 0x98
at Markdig.Renderers.RendererBase.Write(MarkdownObject) + 0xc8
at Markdig.Renderers.TextRendererBase.Render(MarkdownObject) + 0x18
at Markdig.Markdown.ToHtml(MarkdownDocument, MarkdownPipeline) + 0x68
at Elastic.Markdown.Myst.Directives.DirectiveHtmlRenderer.WriteIncludeBlock(HtmlRenderer, IncludeBlock, MarkdownParser) + 0xa0
at Markdig.Renderers.RendererBase.Write(MarkdownObject) + 0xf4
at Markdig.Renderers.RendererBase.WriteChildren(ContainerBlock) + 0x98
at Markdig.Renderers.RendererBase.Write(MarkdownObject) + 0xc8
at Markdig.Renderers.TextRendererBase.Render(MarkdownObject) + 0x18
at Markdig.Markdown.ToHtml(MarkdownDocument, MarkdownPipeline) + 0x68
at Elastic.Markdown.IO.MarkdownFile.CreateHtml(MarkdownDocument) + 0xb4
at Elastic.Markdown.Slices.HtmlWriter.<RenderLayout>d__13.MoveNext() + 0x7c
--- End of stack trace from previous location ---
at Elastic.Markdown.Slices.HtmlWriter.<RenderLayout>d__12.MoveNext() + 0x114
--- End of stack trace from previous location ---
at Elastic.Markdown.DocumentationGenerator.<RenderLayout>d__30.MoveNext() + 0x118
--- End of stack trace from previous location ---
at Documentation.Builder.Http.DocumentationWebHost.<ServeDocumentationFile>d__7.MoveNext() + 0x7c
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Http.Generated.<GeneratedRouteBuilderExtensions_g>F4AFC7A6FBD6950F13FBA11F9A5ABB0022287BBD24ED0D909344A974D534EC189__GeneratedRouteBuilderExtensionsCore.<>c__DisplayClass3_0.<<MapGet1>g__RequestHandler|5>d.MoveNext() + 0x23c
--- End of stack trace from previous location ---
at Westwind.AspNetCore.LiveReload.LiveReloadMiddleware.<HandleHtmlInjection>d__8.MoveNext() + 0x160
--- End of stack trace from previous location ---
at Westwind.AspNetCore.LiveReload.LiveReloadMiddleware.<InvokeAsync>d__6.MoveNext() + 0x144
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.<<Invoke>g__Awaited|10_0>d.MoveNext() + 0xa4
Inner Exception: None
Expected behavior
Page should load
Steps to reproduce
Build latest docs-builder locally, then change to elasticsearch source directory and run:
../docs-builder/.artifacts/publish/docs-builder/release/docs-builder serve -p docs
Browse to localhost:3000/reference/, and navigate to:
- Query languages
- ES|QL reference
- Functions and operators
- ES|QL reference
Tooling
- docs-builder
- migration tooling
- I'm not sure