Skip to content

fix: Pipeline TypeError: can only concatenate list (not "NoneType") to list Using Sou (#5518)#20

Closed
aviruthen wants to merge 1 commit intomasterfrom
fix/pipeline-typeerror-can-only-concatenate-list-not-5518-2
Closed

fix: Pipeline TypeError: can only concatenate list (not "NoneType") to list Using Sou (#5518)#20
aviruthen wants to merge 1 commit intomasterfrom
fix/pipeline-typeerror-can-only-concatenate-list-not-5518-2

Conversation

@aviruthen
Copy link
Copy Markdown
Owner

Description

Fix TypeError when Pipeline upsert with SourceCode without requirements

Fixes aws#5518

Problem

When using SourceCode without specifying requirements (which defaults to None), calling pipeline.upsert() raises a TypeError: can only concatenate list (not 'NoneType') to list in get_processing_code_hash.

This occurs because get_processing_code_hash directly concatenates the dependencies parameter with a list (e.g., [code, source_dir] + dependencies) without checking if dependencies is None.

Solution

Added a defensive dependencies = dependencies or [] guard at the start of get_processing_code_hash() to handle None dependencies gracefully, converting them to an empty list before any list concatenation occurs.

Note: get_training_code_hash already handles None dependencies correctly with if dependencies: guards.

Testing

Added test cases to verify:

  • get_processing_code_hash with None dependencies does not raise TypeError
  • get_processing_code_hash with None dependencies works correctly with source_dir, code only, and both
  • get_training_code_hash with None dependencies works correctly with source_dir and entry_point only

Related Issue

Fixes aws#5518

Changes Made

The bug occurs when SourceCode.requirements is None (the default when not specified) and this None value gets passed as the dependencies parameter to hash functions that attempt list concatenation. The get_processing_code_hash function directly concatenates dependencies with a list without checking for None, causing TypeError: can only concatenate list (not 'NoneType') to list. The get_training_code_hash function already has if dependencies: guards in the current codebase, but get_processing_code_hash does not. Additionally, the get_code_hash function should defensively default None requirements to avoid passing None downstream. The fix is twofold: (1) in get_code_hash, default requirements to None handled properly, and (2) in get_processing_code_hash, add a dependencies = dependencies or [] guard at the start of the function body to handle None dependencies gracefully.

AI-Generated PR

This PR was automatically generated by the PySDK Issue Agent.

  • Confidence score: 92%
  • Classification: bug
  • SDK version target: V3

Merge Checklist

  • Changes are backward compatible
  • Commit message follows prefix: description format
  • Unit tests added/updated
  • Integration tests added (if applicable)
  • Documentation updated (if applicable)

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment explaining why dependencies should default to [] if it is None? Leave all other source code changes the same!

@aviruthen aviruthen closed this Mar 20, 2026
@aviruthen aviruthen deleted the fix/pipeline-typeerror-can-only-concatenate-list-not-5518-2 branch March 20, 2026 23:24
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

Successfully merging this pull request may close these issues.

Pipeline TypeError: can only concatenate list (not "NoneType") to list Using SourceCode

1 participant