Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic pipeline: custom errors

Radu Cristescu
December 18, 2025

Is it possible to return a custom error from a Dynamic Pipeline, and have it displayed in the Pipeline page instead of stuff like the following?

 

Configuration error

Selected Dynamic Pipelines provider is malformed and can't be invoked: There was an error invoking the function - Cannot read properties of null (reading 'pipe')

 

The part after the dash is a JS error caused by someone sending me a script with a null array element (they wrote a "-" with no string after it in the pipeline script YML array).

I want to catch that and return an error message to tell them to fix it instead of working around it.

As things stand, I had to go through the Forge Logs to figure out what went wrong and why I was getting a null where only a string or a non-null object are expected.

 

It gets stranger: I updated my code so that it just returns the null/undefined step without processing, and the error still says "Cannot read properties of null (reading 'pipe')". But that code is not executed anymore, as far as I can see when using the tunnel. But I also have a result, because the dynamic pipeline did not crash, contrary to what the red message says: "This pipeline is generated by dynamic pipelines. View the configuration"

1 comment

Comment

Log in or Sign up to comment
Radu Cristescu
December 18, 2025

Without a dynamic pipeline, Bitbucket doesn't throw an error at all. It just pretends the "null" script line isn't there.

But for my case, I'd rather tell the developer the "null" line is wrong. Here's the idea I came up while experimenting: I'll make "null" a special DSL word, and I'll return a step that always fails. That should draw their attention and not crash the dynamic pipeline in a state where it cannot be rerun without a dummy commit.

I could inject the failing step at the beginning of every pipeline so they get a "Syntax error" step and no pipeline steps will run at all.

Radu Cristescu
December 18, 2025

And lightbulb moment: Just throw an `Error` object with the message. It will be displayed in the red message. Such simplicity, and I had to make it so complicated...

TAGS
AUG Leaders

Atlassian Community Events