Splunk SOAR

Joining 2 code blocks to an action. Will encounter "unexpected-keyword-arg" error

shangxuan_shi
Explorer

I have not encounter this error previously. When I join two code block to an action block using the visual editor. A join_***_***_1 block will be created. 

This auto generated block is using the the "code_name" parameter which is triggering the unexpected-keyword-arg error. 

I believe by deleting this auto generated block would be able to resolve the problem. But making changes to this auto generated block, it will disable the visual editor, which is not the right situation. 

Any other alternative solution to resolve this problem?

shangxuan_shi_2-1749115291369.pngshangxuan_shi_0-1749115244402.png

shangxuan_shi_1-1749115275135.png

 

 

Labels (1)
0 Karma

Butz
Engager

I am getting this today too.

This code_name is not valid per the docs, but its being placed there by the gui editor behind the scence.  I cannot edit the join_ function without breaking the gui restrictions and going straight code. (classic playbook)


here is example:

@phanTom.playbook_block()
def code_7(action=None, success=None, container=None, results=None, handle=None, filtered_artifacts=None, filtered_results=None, custom_function=None, loop_state_json=None, **kwargs):
    phantom.debug("code_7() called")
 
    ################################################################################
    ## Custom Code Start
    ################################################################################
 
    # Write your custom code here...
 
    ################################################################################
    ## Custom Code End
    ################################################################################
 
    join_code_9(container=container)
 
    return

@phantom.playbook_block()
def code_8(action=None, success=None, container=None, results=None, handle=None, filtered_artifacts=None, filtered_results=None, custom_function=None, loop_state_json=None, **kwargs):
    phantom.debug("code_8() called")
 
    ################################################################################
    ## Custom Code Start
    ################################################################################
 
    # Write your custom code here...
 
    ################################################################################
    ## Custom Code End
    ################################################################################
 
    join_code_9(container=container)
 
    return

**** This part is auto generated by the SOAR GUI editor*****

@phantom.playbook_block()
def join_code_9(action=None, success=None, container=None, results=None, handle=None, filtered_artifacts=None, filtered_results=None, custom_function=None, loop_state_json=None, **kwargs):
    phantom.debug("join_code_9() called")
 
    if phantom.completed(code_names=["code_7", "code_8"]):
        # call connected block "code_9"
        code_9(container=container, handle=handle)
 
    return

 

0 Karma

livehybrid
SplunkTrust
SplunkTrust

Hi @shangxuan_shi 

The phantom.completed method doesnt take a code_names param, the function accepts the following:

phantom.completed(action_names=None, playbook_names=None, custom_function_names=None, trace=False)

 Check out https://docs.splunk.com/Documentation/Phantom/4.10.7/PlaybookAPI/PlaybookAPI#:~:text=action%20and%20... for more details on the phantom.completed method

🌟 Did this answer help you? If so, please consider:

  • Adding karma to show it was useful
  • Marking it as the solution if it resolved your issue
  • Commenting if you need any clarification

Your feedback encourages the volunteers in this community to continue contributing

0 Karma

shangxuan_shi
Explorer

I see. Now I know why did the Validate Python report an error. 

However, as mentioned earlier. This block of code is automatically generated when I ammend the visual editor. Changing the "code_names" to either "action_names" or "custom_function_names" will result in disabling the visual editor. Which would create a big trouble for my future development of this playbook. 

Butz
Engager

you can replace "code_names" with "custom_function_names", it will pass linting and work, but like you said, it will force you out of the GUI editor. I've put in a support ticket.  they should just update that GUI editor to use the documented parameter and we'll be back on track.

0 Karma

shangxuan_shi
Explorer

Thank you for raising the support ticket. But I am quite new to Splunk. May I know how long will splunk take to response to the ticket and resolve the bug. 

Also, Just to check with you, this is a new error that just occur right? Because, I did not encounter this error weeks ago.

0 Karma

livehybrid
SplunkTrust
SplunkTrust

Hi @shangxuan_shi 

It would be worthwhile raising a Support ticket yourself aswell as @Butz  ticket, this will add a little weight as demonstrates multiple users are affected by the issue.

You can access Support via https://www.splunk.com/support

🌟 Did this answer help you? If so, please consider:

  • Adding karma to show it was useful
  • Marking it as the solution if it resolved your issue
  • Commenting if you need any clarification

Your feedback encourages the volunteers in this community to continue contributing

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...